PFCachePolicy Constants Reference
Declared in | PFConstants.h |
---|---|
References | PFQuery |
PFCachePolicy
PFCachePolicy
specifies different caching policies that could be used with PFQuery.
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.
Warning: Cache policy could only be set when Local Datastore is not enabled.
Definition
typedef NS_ENUM(uint8_t, PFCachePolicy ) {
kPFCachePolicyIgnoreCache = 0,
kPFCachePolicyCacheOnly,
kPFCachePolicyNetworkOnly,
kPFCachePolicyCacheElseNetwork,
kPFCachePolicyNetworkElseCache,
kPFCachePolicyCacheThenNetwork,
};
Constants
kPFCachePolicyIgnoreCache
-
The query does not load from the cache or save results to the cache. This is the default cache policy.
Declared In
PFConstants.h
. kPFCachePolicyCacheOnly
-
The query only loads from the cache, ignoring the network. If there are no cached results, this causes a
NSError
withkPFErrorCacheMiss
code.Declared In
PFConstants.h
. kPFCachePolicyNetworkOnly
-
The query does not load from the cache, but it will save results to the cache.
Declared In
PFConstants.h
. kPFCachePolicyCacheElseNetwork
-
The query first tries to load from the cache, but if that fails, it loads results from the network. If there are no cached results, this causes a
NSError
withkPFErrorCacheMiss
code.Declared In
PFConstants.h
. kPFCachePolicyNetworkElseCache
-
The query first tries to load from the network, but if that fails, it loads results from the cache. If there are no cached results, this causes a
NSError
withkPFErrorCacheMiss
code.Declared In
PFConstants.h
. kPFCachePolicyCacheThenNetwork
-
The query first loads from the cache, then loads from the network. The callback will be called twice - first with the cached results, then with the network results. Since it returns two results at different times, this cache policy cannot be used with synchronous or task methods.
Declared In
PFConstants.h
.
See Also
Declared In
PFConstants.h