com.github.pojomvcc.CacheExpirationHandler Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of pojo-mvcc Show documentation
Show all versions of pojo-mvcc Show documentation
A simple in-memory POJO Multi Version Concurrency Control (MVCC) cache.
The newest version!
package com.github.pojomvcc;
/**
* A {@link CacheExpirationHandler} is invoked when a {@link RevisionKeyList} has
* been decided to be evicted by the {@link CacheExpiryPolicy}.
*
* This can be used for persistent backup etc. This is an OPTIONAL interface and does not have to
* be implemented.
*
* @author Aidan Morgan
*/
public interface CacheExpirationHandler {
/**
* Called when the provided {@link RevisionKeyList} is about to be evicted from the
* {@link RootObjectCache}.
*
* Perform whatever operations are required, typically used for persisting the revision to some other
* storage mechanism.
*
* @param rev the {@link RevisionKeyList} to test for expiration.
*/
public void expired(RevisionKeyList rev);
/**
* Called by the {@link RootObjectCache} when a specific revision of the
* {@link com.github.pojomvcc.RootObjectCache} with the provided {@link K} cannot be found
* in-memory.
*
* Implementations should return {@code null} if they cannot find the revision.
*
* @param key The key for the element to be retrieved.
* @param revision The revision number.
* @return The element revision.
*/
public CacheElementRevision retrieve(K key, long revision);
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy