K
- the cache key typeV
- the cache value typepublic class SimpleCache<K,V extends Identifiable<K>> extends Object implements Cache<K,V>
Cache
implementation using in-memory storage and eager expiration.CURRENT_GROUP
Constructor and Description |
---|
SimpleCache(StatefulObjectFactory<V> factory,
IdentifierFactory<K> identifierFactory,
StatefulTimeoutInfo timeout,
ServerEnvironment environment,
ScheduledExecutorService executor) |
Modifier and Type | Method and Description |
---|---|
boolean |
contains(K key)
Indicates whether or not the specified key is contained within this cache.
|
V |
create()
Creates and caches a new instance of
T . |
K |
createIdentifier() |
void |
discard(K key)
Discard the specified object from cache.
|
V |
get(K key)
Get the specified object from cache.
|
int |
getCacheSize() |
int |
getPassivatedCount() |
org.jboss.ejb.client.Affinity |
getStrictAffinity() |
int |
getTotalSize() |
org.jboss.ejb.client.Affinity |
getWeakAffinity(K key) |
void |
release(V bean)
Decreases the objects usage count.
|
void |
remove(K key)
Remove and destroy the specified object from cache.
|
void |
start()
Start the cache.
|
void |
stop()
Stop the cache.
|
public SimpleCache(StatefulObjectFactory<V> factory, IdentifierFactory<K> identifierFactory, StatefulTimeoutInfo timeout, ServerEnvironment environment, ScheduledExecutorService executor)
public void start()
Cache
public void stop()
Cache
public org.jboss.ejb.client.Affinity getStrictAffinity()
getStrictAffinity
in interface AffinitySupport<K>
public org.jboss.ejb.client.Affinity getWeakAffinity(K key)
getWeakAffinity
in interface AffinitySupport<K>
public K createIdentifier()
createIdentifier
in interface IdentifierFactory<K>
public V create()
Cache
T
.public void discard(K key)
Cache
public void remove(K key)
Cache
public V get(K key)
Cache
public boolean contains(K key)
Cache
public void release(V bean)
Cache
public int getCacheSize()
getCacheSize
in interface Cache<K,V extends Identifiable<K>>
public int getPassivatedCount()
getPassivatedCount
in interface Cache<K,V extends Identifiable<K>>
public int getTotalSize()
getTotalSize
in interface Cache<K,V extends Identifiable<K>>
Copyright © 2014 JBoss by Red Hat. All rights reserved.