Package com.oracle.content.sdk
Class CacheSettings
java.lang.Object
com.oracle.content.sdk.CacheSettings
The 
CacheSettings specifies settings for the cache behavior of the SDK
 The cacheDir is required to enable the cache.
     Here is an example of creating a CacheSettings:
    
  CacheSettings cacheSettings = new CacheSettings(context.getCacheDir());
 
 If not specified, there are default values for cache size (10MB), as well
 as in-memory cache expiration (2 minutes) and offline cache (7 days).
 The offline cache will allow you to request cached SDK results even if
 there is no network access.- 
Nested Class SummaryNested ClassesModifier and TypeClassDescriptionstatic final classExpiration time class to tweak the expiration values for cache.
- 
Field SummaryFields
- 
Constructor SummaryConstructorsConstructorDescriptionCacheSettings(File cacheDir) Construct cache config specifying a cache dir to enable it.
- 
Method SummaryModifier and TypeMethodDescriptionenableOfflineCache(boolean enable) By default, if the cache is enabled the offline cache is enabled.booleanIs the cache enabled?booleanIs offline cache enabled?setAssetCacheDir(File dir) Optionally override the cache folder to use for assets.setAssetCacheSize(long size) Override the maximum asset cache size.voidsetCacheExpiration(CacheSettings.Expiration expiration) Set the general cache expiration valuesetHttpCacheSize(long size) Set the cache size in bytes.voidsetOfflineCacheExpiration(CacheSettings.Expiration expiration) Set the offline cache expiration value
- 
Field Details- 
MBpublic static final long MB- See Also:
 
 
- 
- 
Constructor Details- 
CacheSettingsConstruct cache config specifying a cache dir to enable it. Both http and asset caches are enabled by default. If set to null, cache is disabled.- Parameters:
- cacheDir- directory location to store cache
 
 
- 
- 
Method Details- 
isEnabledpublic boolean isEnabled()Is the cache enabled?- Returns:
- true if the cache is enabled
 
- 
setAssetCacheDirOptionally override the cache folder to use for assets. Set to null to effectively turn off cache for assets.- Parameters:
- dir- the asset cache dir
- Returns:
- this
 
- 
setHttpCacheSizeSet the cache size in bytes.- Parameters:
- size- cache size in bytes
- Returns:
- this
 
- 
setAssetCacheSizeOverride the maximum asset cache size.- Parameters:
- size- Size in bytes
- Returns:
- this
 
- 
isOfflineCacheEnabledpublic boolean isOfflineCacheEnabled()Is offline cache enabled?- Returns:
- true if offline cache is enabled
 
- 
enableOfflineCacheBy default, if the cache is enabled the offline cache is enabled. Call this method with 'false' to disable just offline cache.- Parameters:
- enable- true to enable offline cache (default) or false to disable
- Returns:
- this
 
- 
setCacheExpirationSet the general cache expiration value- Parameters:
- expiration- general cache expiration
 
- 
setOfflineCacheExpirationSet the offline cache expiration value- Parameters:
- expiration- general cache expiration
 
 
-