Class FileCacheImpl
java.lang.Object
com.atlassian.plugin.cache.filecache.impl.FileCacheImpl
- All Implemented Interfaces:
Cache
Implements a thread-safe FileCache.
This implementation uses a computing map LRU map to create missing entries, and an eviction listener to identify files that need to be deleted.
Concurrent control to the contents of each cache entry is implemented in StreamsCache
- Since:
- v2.13
-
Nested Class Summary
Nested classes/interfaces inherited from interface com.atlassian.plugin.cache.filecache.Cache
Cache.StreamProvider, Cache.TwoStreamProvider -
Field Summary
Fields -
Constructor Summary
Constructors -
Method Summary
Modifier and TypeMethodDescriptionbooleancache(String bucket, String key, OutputStream out, Cache.StreamProvider provider) Stream the contents identified by the key to the destination stream.booleancacheTwo(String bucket, String key, OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider) Stream two contents identified by the key to the destination stream.voidclear()Remove all entries in the cache.static OutputStreamensureNotNull(OutputStream stream) protected StringAtomically generates next file name for the cache file.
-
Field Details
-
EXT
- See Also:
-
-
Constructor Details
-
FileCacheImpl
- Parameters:
tmpDir- directory to store cache contents. Files in this dir will be deleted by constructormaxSize- size of the LRU cache. zero means evict-immediately- Throws:
IOException
-
-
Method Details
-
ensureNotNull
-
cache
Description copied from interface:CacheStream the contents identified by the key to the destination stream. Should the contents not exist in the cache a new entry should be created if the implementation is a caching implementation. -
cacheTwo
public boolean cacheTwo(String bucket, String key, OutputStream out1, OutputStream out2, Cache.TwoStreamProvider provider) Description copied from interface:CacheStream two contents identified by the key to the destination stream. Should the contents not exist in the cache a new entry should be created if the implementation is a caching implementation. -
clear
public void clear()Description copied from interface:CacheRemove all entries in the cache. -
generateNextFileName
Atomically generates next file name for the cache file.
-