public abstract class CacheWriter<K,V> extends Object
Cache
interface, e.g. Cache.put(Object, Object)
or
Cache.remove(Object)
will cause a writer call.Constructor and Description |
---|
CacheWriter() |
Modifier and Type | Method and Description |
---|---|
abstract void |
delete(K key)
Called when a mapping is removed from the cache.
|
abstract void |
write(K key,
V value)
Called when the value was updated or inserted into the cache.
|
public abstract void write(K key, V value) throws Exception
Calling cache operations: It is illegal to call any cache methods from this method. This may have an undesired effect and can cause a deadlock.
key
- key of the value to be written, never null.value
- the value to be written, may be null if null is permitted.Exception
- if an exception occurs, the cache update will not occur and this
exception will be wrapped in a CacheWriterException
public abstract void delete(K key) throws Exception
Cache.remove(K)
or Cache.removeAll()
. An expiry does not trigger a call
to this method.key
- key of the value removed from the cache, never null.Exception
- if an exception occurs, the cache update will not occur and this
exception will be wrapped in a CacheWriterException
cache2k API documentation. Copyright © 2000–2020 headissue GmbH, Munich.