net.sf.ehcache.store

Interface Store

public interface Store

This is the interface for all stores. A store is a physical counterpart to a cache, which is a logical concept.

Version: $Id: Store.java 51 2006-04-24 09:21:10Z gregluck $

Author: Greg Luck

Method Summary
booleancontainsKey(Object key)
A check to see if a key is in the Store.
voiddispose()
Prepares for shutdown.
Elementget(Object key)
Gets an item from the cache.
intgetSize()
Returns the current store size.
StatusgetStatus()
Returns the cache status.
voidput(Element element)
Puts an item into the cache.
Elementremove(Object key)
Removes an item from the cache.
voidremoveAll()
Remove all of the elements from the store.

Method Detail

containsKey

public boolean containsKey(Object key)
A check to see if a key is in the Store.

Parameters: key The Element key

Returns: true if found. No check is made to see if the Element is expired. 1.2

dispose

public void dispose()
Prepares for shutdown.

get

public Element get(Object key)
Gets an item from the cache.

getSize

public int getSize()
Returns the current store size.

getStatus

public Status getStatus()
Returns the cache status.

put

public void put(Element element)
Puts an item into the cache.

remove

public Element remove(Object key)
Removes an item from the cache.

Since: signature changed in 1.2 from boolean to Element to support notifications

removeAll

public void removeAll()
Remove all of the elements from the store.

If there are registered CacheEventListeners they are notified of the expiry or removal of the Element as each is removed.