org.apache.openejb.core.stateful
Interface Cache<K,V>

All Known Implementing Classes:
SimpleCache

public interface Cache<K,V>


Nested Class Summary
static interface Cache.CacheFilter<V>
          CacheFileter is used to select values to remove during a removeAll invocation.
static interface Cache.CacheListener<V>
          Callback listener for cache events.
 
Method Summary
 void add(K key, V value)
          Add a new entry to the cache.
 void checkIn(K key)
          Marks the entry available, so it can be accessed again.
 V checkOut(K key)
          Marks the entry checked-out, so this entry can not be accessed until checked-in.
 Cache.CacheListener<V> getListener()
          Gets the listener for cache events.
 V remove(K key)
          Removes the entry from the cache.
 void removeAll(Cache.CacheFilter<V> filter)
          Removes all of th entries that match the specified filter.
 void setListener(Cache.CacheListener<V> listener)
          Sets the listener for cache events.
 

Method Detail

getListener

Cache.CacheListener<V> getListener()
Gets the listener for cache events.


setListener

void setListener(Cache.CacheListener<V> listener)
Sets the listener for cache events. This should be called by the container before using the cache.


add

void add(K key,
         V value)
Add a new entry to the cache. The entry is marked checked-out and can not be accessed again until checked-in.


checkOut

V checkOut(K key)
           throws java.lang.Exception
Marks the entry checked-out, so this entry can not be accessed until checked-in.

Throws:
java.lang.IllegalStateException - if the entry is already checked out.
java.lang.Exception - if an entry is loaded and the afterLoad method threw an exception

checkIn

void checkIn(K key)
Marks the entry available, so it can be accessed again.

Throws:
java.lang.IllegalStateException - if the entry is not checked out.

remove

V remove(K key)
Removes the entry from the cache.


removeAll

void removeAll(Cache.CacheFilter<V> filter)
Removes all of th entries that match the specified filter.



Copyright © 1999-2011 The Apache OpenEJB development community. All Rights Reserved.