public abstract class LruDiskCache<K,V> extends Object implements DiskCache<K,V>
| Constructor and Description |
|---|
LruDiskCache(File directory,
int appVersion,
long maxSize) |
| Modifier and Type | Method and Description |
|---|---|
void |
clear()
Cleans the cache, by removing all cache entries
|
CacheEntry<V> |
get(K key,
Class<?> targetClass,
int collectionType) |
void |
put(K key,
V value,
String mimeType,
String charsetEncoding,
long expirationTimeStamp,
String eTag)
Adds and create a new
CacheEntry to the cache. |
void |
putRaw(K key,
byte[] value,
String mimeType,
String charsetEncoding,
long expirationTimeStamp,
String eTag)
Put as raw bytes
|
void |
remove(K key)
Removes the Entry
|
void |
setParserWriterPool(ParserWriterPool pool)
Used to give the disk cache all available
ParserWriters
to read or write data |
void |
updateExpirationTimestamp(K key,
long expirationTimestamp)
Will be called to update an expiration timestamp.
|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitisForMimeTypepublic LruDiskCache(File directory, int appVersion, long maxSize) throws IOException
IOExceptionpublic void setParserWriterPool(ParserWriterPool pool)
DiskCacheParserWriters
to read or write datasetParserWriterPool in interface DiskCache<K,V>public void put(K key, V value, String mimeType, String charsetEncoding, long expirationTimeStamp, String eTag) throws Exception
DiskCacheCacheEntry to the cache.put in interface DiskCache<K,V>key - The keyvalue - The Value for the given keymimeType - The mime type of the value. This is important to find the
correct parser for the stored cache valuecharsetEncoding - The charset like, UTF-8 etc. that i used, to encode the
string content (is useless for binary data)expirationTimeStamp - The expiration valueeTag - The ETagExceptionpublic void putRaw(K key, byte[] value, String mimeType, String charsetEncoding, long expirationTimeStamp, String eTag) throws Exception
DiskCachepublic void remove(K key) throws IOException
SubCacheremove in interface SubCache<K,V>IOExceptionpublic void clear()
throws IOException
DiskCacheclear in interface DiskCache<K,V>IOExceptionpublic CacheEntry<V> get(K key, Class<?> targetClass, int collectionType) throws Exception
public void updateExpirationTimestamp(K key, long expirationTimestamp)
SubCacheupdateExpirationTimestamp in interface SubCache<K,V>Copyright © 2015 Hannes Dorfmann. All rights reserved.