| java.lang.Object | ||
| ↳ | com.neomades.content.cache.FileCache | |
| ↳ | com.neomades.content.cache.DefaultFileCache | |
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.
| 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
| |||||||||||
Constructs an instance of the DefaultFileCache at the specified
directory using the default maximum cache size of 5MB.
| rootDirectory | The root directory of the cache. |
|---|
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.
| rootDirectory | The root directory of the cache. |
|---|---|
| maxCacheSizeInBytes | The maximum size of the cache in bytes. |
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.
| key | the cache key |
|---|
DefaultCacheEntry or null if the
DefaultCacheEntry can not be found.