@ThreadSafe public class DefaultDataContainer extends Object implements DataContainer
| Modifier and Type | Class and Description |
|---|---|
static class |
DefaultDataContainer.EntryIterator |
| Modifier and Type | Field and Description |
|---|---|
protected ConcurrentMap<Object,InternalCacheEntry> |
entries |
protected InternalEntryFactory |
entryFactory |
protected org.infinispan.container.DefaultDataContainer.DefaultEvictionListener |
evictionListener |
| Modifier | Constructor and Description |
|---|---|
|
DefaultDataContainer(int concurrencyLevel) |
protected |
DefaultDataContainer(int concurrencyLevel,
int maxEntries,
EvictionStrategy strategy,
EvictionThreadPolicy policy) |
| Modifier and Type | Method and Description |
|---|---|
static DataContainer |
boundedDataContainer(int concurrencyLevel,
int maxEntries,
EvictionStrategy strategy,
EvictionThreadPolicy policy) |
void |
clear()
Removes all entries in the container
|
boolean |
containsKey(Object k)
Tests whether an entry exists in the container
|
Set<InternalCacheEntry> |
entrySet()
Returns a mutable set of immutable cache entries exposed as immutable Map.Entry instances.
|
InternalCacheEntry |
get(Object k)
Retrieves a cached entry
|
void |
initialize(EvictionManager evictionManager,
PassivationManager passivator,
InternalEntryFactory entryFactory) |
Iterator<InternalCacheEntry> |
iterator() |
Set<Object> |
keySet()
Returns a set of keys in the container.
|
InternalCacheEntry |
peek(Object key)
Retrieves a cache entry in the same way as
DataContainer.get(Object)}
except that it does not update or reorder any of the internal constructs. |
void |
purgeExpired()
Purges entries that have passed their expiry time
|
void |
put(Object k,
Object v,
EntryVersion version,
long lifespan,
long maxIdle)
Puts an entry in the cache along with a lifespan and a maxIdle time
|
InternalCacheEntry |
remove(Object k)
Removes an entry from the cache
|
int |
size() |
static DataContainer |
unBoundedDataContainer(int concurrencyLevel) |
Collection<Object> |
values() |
protected final ConcurrentMap<Object,InternalCacheEntry> entries
protected InternalEntryFactory entryFactory
protected final org.infinispan.container.DefaultDataContainer.DefaultEvictionListener evictionListener
public DefaultDataContainer(int concurrencyLevel)
protected DefaultDataContainer(int concurrencyLevel,
int maxEntries,
EvictionStrategy strategy,
EvictionThreadPolicy policy)
public void initialize(EvictionManager evictionManager, PassivationManager passivator, InternalEntryFactory entryFactory)
public static DataContainer boundedDataContainer(int concurrencyLevel, int maxEntries, EvictionStrategy strategy, EvictionThreadPolicy policy)
public static DataContainer unBoundedDataContainer(int concurrencyLevel)
public InternalCacheEntry peek(Object key)
DataContainerDataContainer.get(Object)}
except that it does not update or reorder any of the internal constructs.
I.e., expiration does not happen, and in the case of the LRU container,
the entry is not moved to the end of the chain.
This method should be used instead of DataContainer.get(Object)} when called
while iterating through the data container using methods like DataContainer.keySet()
to avoid changing the underlying collection's order.peek in interface DataContainerkey - key under which entry is storedpublic InternalCacheEntry get(Object k)
DataContainerget in interface DataContainerk - key under which entry is storedpublic void put(Object k, Object v, EntryVersion version, long lifespan, long maxIdle)
DataContainerput in interface DataContainerk - key under which to store entryv - value to storelifespan - lifespan in milliseconds. -1 means immortal.maxIdle - max idle time for which to store entry. -1 means forever.public boolean containsKey(Object k)
DataContainercontainsKey in interface DataContainerk - key to testpublic InternalCacheEntry remove(Object k)
DataContainerremove in interface DataContainerk - key to removepublic int size()
size in interface DataContainerpublic void clear()
DataContainerclear in interface DataContainerpublic Set<Object> keySet()
DataContainer#get() method but instead #peek(), in order to avoid
changing the order of the underlying collection as a side of effect of iterating through it.keySet in interface DataContainerpublic Collection<Object> values()
values in interface DataContainerpublic Set<InternalCacheEntry> entrySet()
DataContainerentrySet in interface DataContainerpublic void purgeExpired()
DataContainerpurgeExpired in interface DataContainerpublic Iterator<InternalCacheEntry> iterator()
iterator in interface Iterable<InternalCacheEntry>Copyright © 2012 JBoss by Red Hat. All Rights Reserved.