public interface BackingCache<K extends Serializable,V extends Cacheable<K>,E extends BackingCacheEntry<K,V>> extends Removable<K>, AffinitySupport<K>
Cache
delegates, either directly or indirectly.
There are two key distinctions between a BackingCache and the external-facing Cache:
Cacheable
interface. CacheItem is deliberately
limited to avoid placing a implementation burden on external classes. A BackingCache works with instances of the more
expressive internal interface BackingCacheEntry
, and thus can directly implement more complex functionality.BackingCacheEntry
instances, beyond
the simple act of marking the entries as being in or out of use
. It assumes the
external-facing Cache is preventing concurrent access to a given entry and is properly coordinating calls to the backing
cache.Modifier and Type | Method and Description |
---|---|
void |
addLifecycleListener(BackingCacheLifecycleListener listener)
Registers a listener for callbacks when the cache starts and stops.
|
E |
create()
Creates and caches a new instance of
C , wrapped by a new T . |
void |
discard(K key)
Discard the specified object from cache.
|
E |
get(K key)
Get the specified object from cache.
|
boolean |
isClustered()
Gets whether this cache supports clustering functionality.
|
E |
peek(K key)
Peek at an object which might be in use.
|
E |
release(K key)
Release the object from use.
|
void |
removeLifecycleListener(BackingCacheLifecycleListener listener)
Removes a registered lifecycle listener.
|
void |
start()
Start the cache.
|
void |
stop()
Stop the cache.
|
getStrictAffinity, getWeakAffinity, hasAffinity
E create()
C
, wrapped by a new T
. The new T
*is*
returned, but is not regarded as being "in use". Callers *must not* attempt to use the underlying C
without
first calling #get(Object)
.T
E get(K key) throws javax.ejb.NoSuchEJBException
key
- the identifier of the objectjavax.ejb.NoSuchEJBException
- if the object does not existE peek(K key) throws javax.ejb.NoSuchEJBException
key
- the identifier of the objectjavax.ejb.NoSuchEJBException
- if the object does not existE release(K key)
key
- the identifier of the objectvoid discard(K key)
key
- the identifier of the objectvoid start()
void stop()
boolean isClustered()
true
if clustering is supported, false
otherwisevoid addLifecycleListener(BackingCacheLifecycleListener listener)
listener
- the listener. Cannot be null
.void removeLifecycleListener(BackingCacheLifecycleListener listener)
listener
- the listener. Cannot be null
.Copyright © 2013 JBoss, a division of Red Hat, Inc.. All rights reserved.