public interface DataContainer<K,V> extends Iterable<InternalCacheEntry<K,V>>
Cache. If you wish to convert
entries to the stored format, you should use the provided DataConversion such as
cache.getAdvancedCache().getKeyDataConversion().toStorage(key);when dealing with keys or the following when dealing with values
cache.getAdvancedCache().getValueDataConversion().toStorage(value);You can also convert from storage to the user provided type by using the
DataConversion.fromStorage(Object) method on any value returned from the DataContainer| Modifier and Type | Interface and Description |
|---|---|
static interface |
DataContainer.ComputeAction<K,V> |
| Modifier and Type | Method and Description |
|---|---|
default long |
capacity()
Returns the capacity of the underlying container.
|
void |
clear()
Removes all entries in the container
|
InternalCacheEntry<K,V> |
compute(K key,
DataContainer.ComputeAction<K,V> action)
Computes the new value for the key.
|
boolean |
containsKey(Object k)
Tests whether an entry exists in the container
|
void |
evict(K key)
Atomically, it removes the key from
DataContainer and passivates it to persistence. |
default long |
evictionSize()
Returns how large the eviction size is currently.
|
InternalCacheEntry<K,V> |
get(Object k)
Deprecated.
since 10.1 - Please use
peek(Object) instead. |
Iterator<InternalCacheEntry<K,V>> |
iterator() |
Iterator<InternalCacheEntry<K,V>> |
iteratorIncludingExpired()
Same as
iterator() except that is also returns expired entries. |
InternalCacheEntry<K,V> |
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 |
put(K k,
V v,
Metadata metadata)
Puts an entry in the cache along with metadata adding information such lifespan of entry, max idle time, version
information...etc.
|
InternalCacheEntry<K,V> |
remove(Object k)
Removes an entry from the cache
The
key must be activate by invoking ActivationManager.activateAsync(Object, int) |
default void |
resize(long newSize)
Resizes the capacity of the underlying container.
|
default int |
size() |
int |
sizeIncludingExpired() |
default Spliterator<InternalCacheEntry<K,V>> |
spliterator() |
default Spliterator<InternalCacheEntry<K,V>> |
spliteratorIncludingExpired()
Same as
spliterator() except that is also returns expired entries. |
@Deprecated InternalCacheEntry<K,V> get(Object k)
peek(Object) instead.k - key under which entry is storedInternalCacheEntry<K,V> 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 iterator() to avoid changing the underlying collection's order.k - key under which entry is storedvoid put(K k, V v, Metadata metadata)
key must be activate by invoking ActivationManager.activateAsync(Object, int)
boolean)}.k - key under which to store entryv - value to storemetadata - metadata of the entryboolean containsKey(Object k)
k - key to testInternalCacheEntry<K,V> remove(Object k)
key must be activate by invoking ActivationManager.activateAsync(Object, int)k - key to removedefault int size()
int sizeIncludingExpired()
void clear()
void evict(K key)
DataContainer and passivates it to persistence.
The passivation must be done by invoking the method PassivationManager.passivateAsync(InternalCacheEntry).key - The key to evict.InternalCacheEntry<K,V> compute(K key, DataContainer.ComputeAction<K,V> action)
DataContainer.ComputeAction.compute(Object,
org.infinispan.container.entries.InternalCacheEntry, InternalEntryFactory).
The key must be activated by invoking ActivationManager.activateAsync(Object, int).
Note the entry provided to DataContainer.ComputeAction may be expired as these
entries are not filtered as many other methods do.
key - The key.action - The action that will compute the new value.InternalCacheEntry associated to the key.Iterator<InternalCacheEntry<K,V>> iterator()
This iterator only returns entries that are not expired, however it will not remove them while doing so.
iterator in interface Iterable<InternalCacheEntry<K,V>>default Spliterator<InternalCacheEntry<K,V>> spliterator()
This spliterator only returns entries that are not expired, however it will not remove them while doing so.
spliterator in interface Iterable<InternalCacheEntry<K,V>>Iterator<InternalCacheEntry<K,V>> iteratorIncludingExpired()
iterator() except that is also returns expired entries.default Spliterator<InternalCacheEntry<K,V>> spliteratorIncludingExpired()
spliterator() except that is also returns expired entries.default void resize(long newSize)
UnsupportedOperationException is thrown otherwise.newSize - the new sizedefault long capacity()
UnsupportedOperationException is thrown
otherwise.default long evictionSize()
UnsupportedOperationException is thrown otherwise. This value will always be lower than the value returned
from capacity()Copyright © 2021 JBoss by Red Hat. All rights reserved.