-
public interface DiskCacheAn interface for writing to and reading from a disk cache.
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description public interfaceDiskCache.FactoryAn interface for lazily creating a disk cache.
public interfaceDiskCache.WriterAn interface to actually write data to a key in the disk cache.
-
Method Summary
Modifier and Type Method Description abstract Fileget(Key key)Get the cache for the value at the given key. abstract voidput(Key key, DiskCache.Writer writer)Write to a key in the cache. abstract voiddelete(Key key)Remove the key and value from the cache. abstract voidclear()Clear the cache. -
-
Method Detail
-
get
@Nullable() abstract File get(Key key)
Get the cache for the value at the given key.
Note - This is potentially dangerous, someone may write a new value to the file at any pointin time and we won't know about it.
- Parameters:
key- The key in the cache.
-
put
abstract void put(Key key, DiskCache.Writer writer)
Write to a key in the cache. Writer is used so that the cache implementation canperform actions after the write finishes, like commit (via atomic file rename).
- Parameters:
key- The key to write to.writer- An interface that will write data given an OutputStream for the key.
-
delete
abstract void delete(Key key)
Remove the key and value from the cache.
- Parameters:
key- The key to remove.
-
clear
abstract void clear()
Clear the cache.
-
-
-
-