net.anotheria.anoprise.cache.BoundedCache Maven / Gradle / Ivy
Go to download
Show more of this group Show more artifacts with this name
Show all versions of ano-prise Show documentation
Show all versions of ano-prise Show documentation
Collection of utils for different enterprise class projects. Among other stuff contains
Caches, Mocking, DualCrud, MetaFactory and SessionDistributorService. Visit https://opensource.anotheria.net for details.
package net.anotheria.anoprise.cache;
import net.anotheria.moskito.core.predefined.CacheStats;
/**
* Interface for caches with limited size.
* @author lrosenberg.
*
* @param cache key.
* @param cache value.
*/
public interface BoundedCache {
/**
* Returns the object for the given id from cache, null if no object is in cache.
* @param id the id to retrieve
* @return
*/
V get(K id);
/**
* Tries to put the cacheable object in cache.
* @param id the object id
* @param cacheable the object to cache.
* @return returns true if the attempt was successful or false if the cache was full.
*/
boolean offer(K id, V cacheable);
void remove(K id);
/**
* Clears the cache.
*
*/
void clear();
CacheStats getCacheStats();
}
© 2015 - 2025 Weber Informatics LLC | Privacy Policy