|
||||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |
java.lang.Objectorg.infinispan.container.SimpleDataContainer
@ThreadSafe public class SimpleDataContainer
Simple data container that does not order entries for eviction, implemented using two ConcurrentHashMaps, one for mortal and one for immortal entries.
This container does not support eviction, in that entries are unsorted. This implementation offers O(1) performance for all operations.
Constructor Summary | |
---|---|
SimpleDataContainer(int concurrencyLevel)
|
Method Summary | |
---|---|
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 |
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,
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()
|
protected void |
successfulPut(InternalCacheEntry ice,
boolean newEntry)
|
Collection<Object> |
values()
|
Methods inherited from class java.lang.Object |
---|
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait |
Constructor Detail |
---|
public SimpleDataContainer(int concurrencyLevel)
Method Detail |
---|
public InternalCacheEntry peek(Object key)
DataContainer
DataContainer.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 DataContainer
key
- key under which entry is stored
public InternalCacheEntry get(Object k)
DataContainer
get
in interface DataContainer
k
- key under which entry is stored
protected void successfulPut(InternalCacheEntry ice, boolean newEntry)
public void put(Object k, Object v, long lifespan, long maxIdle)
DataContainer
put
in interface DataContainer
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.public boolean containsKey(Object k)
DataContainer
containsKey
in interface DataContainer
k
- key to test
public InternalCacheEntry remove(Object k)
DataContainer
remove
in interface DataContainer
k
- key to remove
public int size()
size
in interface DataContainer
public void clear()
DataContainer
clear
in interface DataContainer
public 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 DataContainer
public Collection<Object> values()
values
in interface DataContainer
public Set<InternalCacheEntry> entrySet()
DataContainer
entrySet
in interface DataContainer
public void purgeExpired()
DataContainer
purgeExpired
in interface DataContainer
public Iterator<InternalCacheEntry> iterator()
iterator
in interface Iterable<InternalCacheEntry>
|
Google Analytics | |||||||||
PREV CLASS NEXT CLASS | FRAMES NO FRAMES | |||||||||
SUMMARY: NESTED | FIELD | CONSTR | METHOD | DETAIL: FIELD | CONSTR | METHOD |