public static enum ParseQuery.CachePolicy extends Enum<ParseQuery.CachePolicy>
CachePolicy
specifies different caching policies that could be used with
ParseQuery
.
This lets you show data when the user's device is offline, or when the app has just started and
network requests have not yet had time to complete. Parse takes care of automatically flushing
the cache when it takes up too much space.
Note: Cache policy can only be set when Local Datastore is not enabled.ParseQuery
Enum Constant and Description |
---|
CACHE_ELSE_NETWORK
The query first tries to load from the cache, but if that fails, it loads results from the
network.
|
CACHE_ONLY
The query only loads from the cache, ignoring the network.
|
CACHE_THEN_NETWORK
The query first loads from the cache, then loads from the network.
|
IGNORE_CACHE
The query does not load from the cache or save results to the cache.
|
NETWORK_ELSE_CACHE
The query first tries to load from the network, but if that fails, it loads results from the
cache.
|
NETWORK_ONLY
The query does not load from the cache, but it will save results to the cache.
|
Modifier and Type | Method and Description |
---|---|
static ParseQuery.CachePolicy |
valueOf(String name)
Returns the enum constant of this type with the specified name.
|
static ParseQuery.CachePolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final ParseQuery.CachePolicy IGNORE_CACHE
public static final ParseQuery.CachePolicy CACHE_ONLY
ParseException.CACHE_MISS
.public static final ParseQuery.CachePolicy NETWORK_ONLY
public static final ParseQuery.CachePolicy CACHE_ELSE_NETWORK
ParseException.CACHE_MISS
.public static final ParseQuery.CachePolicy NETWORK_ELSE_CACHE
ParseException.CACHE_MISS
.public static final ParseQuery.CachePolicy CACHE_THEN_NETWORK
public static ParseQuery.CachePolicy[] values()
for (ParseQuery.CachePolicy c : ParseQuery.CachePolicy.values()) System.out.println(c);
public static ParseQuery.CachePolicy valueOf(String name)
name
- the name of the enum constant to be returned.IllegalArgumentException
- if this enum type has no constant with the specified nameNullPointerException
- if the argument is null