public enum

CachePolicy

extends Enum<E extends Enum<E>>
java.lang.Object
   ↳ java.lang.Enum<E extends java.lang.Enum<E>>
     ↳ com.kinvey.java.cache.CachePolicy

Class Overview

Set the caching policy on AppData to getdifferent desired behavior for you app.

See Also
  • {@link com.kinvey.java.AppData#setCache(Cache, CachePolicy)} for more details.

Summary

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
From class java.lang.Enum
From class java.lang.Object
From interface java.lang.Comparable

Enum Values

public static final CachePolicy BOTH

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.

public static final CachePolicy CACHEFIRST

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.

public static final CachePolicy CACHEFIRST_NOREFRESH

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.

public static final CachePolicy CACHEONLY

This policy will only retrieve data from the cache, and will not use any network connection.

public static final CachePolicy NETWORKFIRST

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.

public static final CachePolicy NOCACHE

This policy will not use any caching, and will execute every request online.

Public Methods

public abstract T execute (AbstractKinveyCachedClientRequest<T> cachedRequest)

Throws
IOException

public static CachePolicy valueOf (String name)

public static final CachePolicy[] values ()