java.lang.Object | ||
↳ | java.lang.Enum<E extends java.lang.Enum<E>> | |
↳ | com.kinvey.java.cache.CachePolicy |
Set the caching policy on AppData to getdifferent desired behavior for you app.
Enum Values | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
CachePolicy | BOTH | This policy will first retrieve an element from the cache, and then it will attempt to execute the request on line. | |||||||||
CachePolicy | CACHEFIRST | This policy will first attempt to retrieve data from the cache. | |||||||||
CachePolicy | CACHEFIRST_NOREFRESH | This policy will first attempt to retrieve data from the cache. | |||||||||
CachePolicy | CACHEONLY | This policy will only retrieve data from the cache, and will not use any network connection. | |||||||||
CachePolicy | NETWORKFIRST | This policy will execute the request on the network, and will store the result in the cache. | |||||||||
CachePolicy | NOCACHE | This policy will not use any caching, and will execute every request online. |
Public Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
abstract <T> T | execute(AbstractKinveyCachedClientRequest<T> cachedRequest) | ||||||||||
static CachePolicy | valueOf(String name) | ||||||||||
final static CachePolicy[] | values() |
[Expand]
Inherited Methods | |||||||||||
---|---|---|---|---|---|---|---|---|---|---|---|
![]() | |||||||||||
![]() | |||||||||||
![]() |
This policy will first retrieve an element from the cache, and then it will attempt to execute the request on line. This caching policy will make two calls to the KinveyClientCallback, either onSuccess or onFailure for both executing on the cache as well as executing online.
Use this policy if you want more responsiveness without sacrificing the consistency of data with your backend.
This policy will first attempt to retrieve data from the cache. If the data has been cached, it will be returned. If the data does not exist in the cache, the data will be retrieved from Kinvey's Backend and the cache will be updated.
Use this policy if your application can display data that doesn't change very often but you still want local updates.
This policy will first attempt to retrieve data from the cache. If the data has been cached, it will be returned. If the data does not exist in the cache, the data will be retrieved from Kinvey's Backend but the cache will not be updated with the new results.
Use this policy if you want to set default results, however if a request is made that cannot return these defaults a live request will be made (without modifying those default values)
This policy will only retrieve data from the cache, and will not use any network connection.
Use this policy in combination with another policy, to allow for quick response times without requiring a network connection for specific operations.
This policy will execute the request on the network, and will store the result in the cache. If the online execution fails, the results will be pulled from the cache.
Use this policy if you application wants the latest data but you still want responsiveness if a connection is lost
This policy will not use any caching, and will execute every request online.
Use this policy if your application is dependant on data that is shared between multiple users and always needs to be up to date.