All Downloads are FREE. Search and download functionalities are using the official Maven repository.

net.anotheria.anoprise.cache.BoundedCache Maven / Gradle / Ivy

Go to download

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.

There is a newer version: 4.0.0
Show newest version
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