MLCachePolicy Constants Reference

Declared in MLConstants.h
References MLQuery

MLCachePolicy

MLCachePolicy specifies different caching policies that could be used with MLQuery.

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. MaxLeap 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.

Constants

kMLCachePolicyIgnoreCache
 The query does not load from the cache or save results to the cache.
 This is the default cache policy.

Declared In MLConstants.h.

kMLCachePolicyCacheOnly
 The query only loads from the cache, ignoring the network.
 If there are no cached results, this causes a `NSError` with `kMLErrorCacheMiss` code.

Declared In MLConstants.h.

kMLCachePolicyNetworkOnly
 The query does not load from the cache, but it will save results to the cache.

Declared In MLConstants.h.

kMLCachePolicyCacheElseNetwork
 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` with `kMLErrorCacheMiss` code.

Declared In MLConstants.h.

kMLCachePolicyNetworkElseCache
 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` with `kMLErrorCacheMiss` code.

Declared In MLConstants.h.

kMLCachePolicyCacheThenNetwork
 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.

Declared In MLConstants.h.

See Also

Declared In

MLConstants.h