public interface DataContainer extends Iterable<InternalCacheEntry>
Modifier and Type | Interface and Description |
---|---|
static interface |
DataContainer.ComputeAction |
Modifier and Type | Method and Description |
---|---|
void |
clear()
Removes all entries in the container
|
void |
compute(Object key,
DataContainer.ComputeAction action)
Computes the new value for the key.
|
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.
|
void |
evict(Object key)
Atomically, it removes the key from
DataContainer and passivates it to persistence. |
InternalCacheEntry |
get(Object k)
Retrieves a cached entry
|
Set<Object> |
keySet()
Returns a set of keys in the container.
|
InternalCacheEntry |
peek(Object k)
Retrieves a cache entry in the same way as
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
If the
key does not exists previously, it must be activate by invoking ActivationManager.activate(Object) . |
InternalCacheEntry |
remove(Object k)
Removes an entry from the cache
|
int |
size() |
Collection<Object> |
values() |
InternalCacheEntry get(Object k)
k
- key under which entry is storedInternalCacheEntry peek(Object k)
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 get(Object)
} when called while iterating through the data container
using methods like keySet()
to avoid changing the underlying collection's order.k
- key under which entry is storedvoid put(Object k, Object v, EntryVersion version, long lifespan, long maxIdle)
key
does not exists previously, it must be activate by invoking ActivationManager.activate(Object)
.k
- 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.boolean containsKey(Object k)
k
- key to testInternalCacheEntry remove(Object k)
k
- key to removeint size()
void clear()
Set<Object> keySet()
get(Object)
method but instead peek(Object)
, in order to avoid changing the order of
the underlying collection as a side of effect of iterating through it.Collection<Object> values()
Set<InternalCacheEntry> entrySet()
void purgeExpired()
void evict(Object key)
DataContainer
and passivates it to persistence.
The passivation must be done by invoking the method PassivationManager.passivate(org.infinispan.container.entries.InternalCacheEntry)
.key
- The key to evict.void compute(Object key, DataContainer.ComputeAction action)
DataContainer.ComputeAction.compute(Object, org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory)
.
If the key
does not exists previously, it must be activate by invoking ActivationManager.activate(Object)
.key
- The key.action
- The action that will compute the new value.Copyright © 2017 JBoss, a division of Red Hat. All Rights Reserved.