public class LRUCache<K,V> extends Object
Constructor and Description |
---|
LRUCache(EntryIO<K,V> entryIO,
int cacheSize) |
Modifier and Type | Method and Description |
---|---|
void |
advanceMinReadVersion(long minVersion)
Called as the minimum version that readers will use advances.
|
V |
get(K key,
long version,
Serializer serializer,
boolean neverReplace)
Finds and returns the entry corresponding to the given key and version.
|
void |
put(K key,
V value,
long newVersion,
Serializer serializer,
boolean neverReplace)
Updates the entry identified with the key with the new value.
|
String |
toString() |
public void advanceMinReadVersion(long minVersion)
minVersion
- mimimum version that will be read from the cachepublic void put(K key, V value, long newVersion, Serializer serializer, boolean neverReplace) throws IOException, CacheEvictionException
key
- identifier of the entryvalue
- new value of the entrynewVersion
- version of the new valueserializer
- used in case of IOneverReplace
- true if caller wants to always keep the entry in cacheIOException,
- CacheEvictionExceptionIOException
CacheEvictionException
public V get(K key, long version, Serializer serializer, boolean neverReplace) throws IOException
key
- the identifier for the entryversion
- version the caller want to readserializer
- used in case of IOneverReplace
- true if entry is never synced to disk( entry wont be read from disk if not found in memory )IOException
Copyright © 2019. All rights reserved.