org.jboss.ejb3.cache
Interface Cache<T extends Identifiable>

All Known Subinterfaces:
GroupedPassivatingCache<T>, LongevityCache<T>, PassivatingCache<T>
All Known Implementing Classes:
EntryStateCache, GroupedPassivatingCacheImpl, SimpleCache, SimpleLongevityCache, SimplePassivatingCache

public interface Cache<T extends Identifiable>

Cache a stateful object and make sure any life cycle callbacks are called at the appropriate time. A cache is linked to an object factory. How the link is established is left beyond scope.

Version:
$Revision: $
Author:
Carlo de Wolf

Method Summary
 T create(Class<?>[] initTypes, Object[] initValues)
          Create a new object.
 T get(Object key)
          Get the specified object from cache.
 T peek(Object key)
          Peek at an object which might be in use.
 void release(T obj)
          Release the object from use.
 void remove(Object key)
          Remove the specified object from cache.
 void start()
          Start the cache.
 void stop()
          Stop the cache.
 

Method Detail

create

T create(Class<?>[] initTypes,
         Object[] initValues)
Create a new object.

Parameters:
initTypes -
initValues -
Returns:

get

T get(Object key)
                           throws javax.ejb.NoSuchEJBException
Get the specified object from cache. This will mark the object as being in use.

Parameters:
key - the identifier of the object
Returns:
the object
Throws:
javax.ejb.NoSuchEJBException - if the object does not exist

peek

T peek(Object key)
                            throws javax.ejb.NoSuchEJBException
Peek at an object which might be in use.

Parameters:
key - the identifier of the object
Returns:
the object
Throws:
javax.ejb.NoSuchEJBException - if the object does not exist

release

void release(T obj)
Release the object from use.

Parameters:
obj - the object

remove

void remove(Object key)
Remove the specified object from cache.

Parameters:
key - the identifier of the object

start

void start()
Start the cache.


stop

void stop()
Stop the cache.



Copyright © 2011 JBoss, a division of Red Hat, Inc.. All Rights Reserved.