ehcache

net.sf.ehcache.store
Interface Store

All Known Implementing Classes:
DiskStore, FifoMemoryStore, LfuMemoryStore, LruMemoryStore, MemoryStore

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 704 2008-07-13 00:17:52Z gregluck $
Author:
Greg Luck

Method Summary
 boolean backedUp()
          Some store types, such as the disk stores can get backed up when puts come in to fast.
 boolean containsKey(java.lang.Object key)
          A check to see if a key is in the Store.
 void dispose()
          Prepares for shutdown.
 void expireElements()
          Expire all elements.
 void flush()
          Flush elements to persistent store.
 Element get(java.lang.Object key)
          Gets an item from the cache.
 java.lang.Object[] getKeyArray()
          Gets an Array of the keys for all elements in the disk store.
 Element getQuiet(java.lang.Object key)
          Gets an Element from the Store, without updating statistics
 int getSize()
          Returns the current store size.
 Status getStatus()
          Returns the cache status.
 void put(Element element)
          Puts an item into the cache.
 Element remove(java.lang.Object key)
          Removes an item from the cache.
 void removeAll()
          Remove all of the elements from the store.
 

Method Detail

put

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

Throws:
CacheException

get

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


getQuiet

Element getQuiet(java.lang.Object key)
Gets an Element from the Store, without updating statistics

Returns:
The element

getKeyArray

java.lang.Object[] getKeyArray()
Gets an Array of the keys for all elements in the disk store.

Returns:
An Object[] of Serializable keys

remove

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

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

removeAll

void removeAll()
               throws CacheException
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.

Throws:
CacheException

dispose

void dispose()
Prepares for shutdown.


getSize

int getSize()
Returns the current store size.


getStatus

Status getStatus()
Returns the cache status.


containsKey

boolean containsKey(java.lang.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

expireElements

void expireElements()
Expire all elements.


flush

void flush()
           throws java.io.IOException
Flush elements to persistent store.

Throws:
java.io.IOException - if any IO error occurs

backedUp

boolean backedUp()
Some store types, such as the disk stores can get backed up when puts come in to fast.

Returns:
true if the store is backed up.

ehcache