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

net.anotheria.anoprise.inmemorymirror.InMemoryMirror 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.inmemorymirror;

import java.util.Collection;

/**
 * The InMemoryMirror allows to hold a copy of some small portion of data in memory.
 * @author lrosenberg
 *
 * @param 
 * @param 
 */
public interface InMemoryMirror> {
	/**
	 * Returns all elements as a collection.
	 * @return
	 */
	Collection getAll() throws InMemoryMirrorException;
	/**
	 * Returns the element with given key.
	 * @param id
	 * @return
	 */
	V get(K id) throws InMemoryMirrorException, ElementNotFoundException;
	/**
	 * Removes the element with given key, returns the element previously associated with the key if present, null otherwise.
	 * @param id
	 * @return
	 */
	V remove(K id) throws InMemoryMirrorException;
	/**
	 * Removes the element with given key local only (without InMemorySupport call), returns the element previously associated with the key if present, null otherwise.
	 * @param id
	 * @return
	 */
	V removeLocalOnly(K id) throws InMemoryMirrorException;
	/**
	 * Updates the given element.
	 * @param element
	 */
	void update(V element) throws InMemoryMirrorException, ElementNotFoundException;
	/**
	* Updates the given element local only (without InMemorySupport call).
	* @param element
	*/
	void updateLocalOnly(V element) throws InMemoryMirrorException, ElementNotFoundException;
	/**
	 * Creates a new element out of parameter element, returns the new element as its stored in underlying storage.
	 * @param element
	 * @return
	 */
	V create(V element) throws InMemoryMirrorException;
	/**
	 * Creates a new element out of parameter element local only (without InMemorySupport call), returns the new element as its stored in underlying storage.
	 * @param element
	 * @return
	 */
	V createLocalOnly(V element) throws InMemoryMirrorException;
}




© 2015 - 2025 Weber Informatics LLC | Privacy Policy