public class

DefaultFileCache

extends FileCache
java.lang.Object
   ↳ com.neomades.content.cache.FileCache
     ↳ com.neomades.content.cache.DefaultFileCache

Class Overview

Cache implementation that caches files directly onto the hard disk in the specified directory. Cache data are refreshed using the DefaultCacheEntry mechanism: data in the cache are updated only if a network is connected when the query is sent. In other cases, the response will always use the data in this cache. This cache allow to easily handle not connected mode.

The default disk usage size is 5MB, but is configurable.

To use this class, the NETWORK_STATE permission must be declared in the URS file.

Summary

Public Constructors
DefaultFileCache(File rootDirectory)
Constructs an instance of the DefaultFileCache at the specified directory using the default maximum cache size of 5MB.
DefaultFileCache(File rootDirectory, int maxCacheSizeInBytes)
Constructs an instance of the DefaultFileCache at the specified directory.
Public Methods
DefaultCacheEntry get(String key)
Gets the DefaultCacheEntry associated with the given key.
[Expand]
Inherited Methods
From class com.neomades.content.cache.FileCache
From class java.lang.Object
From interface com.neomades.content.cache.Cache

Public Constructors

public DefaultFileCache (File rootDirectory)

Constructs an instance of the DefaultFileCache at the specified directory using the default maximum cache size of 5MB.

Parameters
rootDirectory The root directory of the cache.

public DefaultFileCache (File rootDirectory, int maxCacheSizeInBytes)

Constructs an instance of the DefaultFileCache at the specified directory.

Do not use the same directory with different caches of FileCache, FileImageCache, DefaultFileCache or other caches.
DefaultFileCache will delete all the files which are not files handled by this cache.

Parameters
rootDirectory The root directory of the cache.
maxCacheSizeInBytes The maximum size of the cache in bytes.

Public Methods

public DefaultCacheEntry get (String key)

Gets the DefaultCacheEntry associated with the given key. Using this type of CacheEntry, data in the cache are updated only if a network is connected when the query is sent. In other cases, the response will always use the data in this cache.

Parameters
key the cache key
Returns