public interface InternalDataContainer<K,V> extends DataContainer<K,V>
This container has a notion of what segments are currently associated with it and these can be controlled via
the removeSegments(IntSet)
and addSegments(IntSet)
methods. A segment can be added multiple times
and the implementation must be able to handle this. If a write occurs on a segment that is not associated with this
container it may ignore the write or it could store it temporarily if needed (additional caching). When segments
are removed, an implementation is free to remove any entries that map to segments that aren't associated to this
container.
DataContainer.ComputeAction<K,V>
Modifier and Type | Method and Description |
---|---|
void |
addRemovalListener(Consumer<Iterable<InternalCacheEntry<K,V>>> listener)
Adds a listener that is invoked whenever
removeSegments(IntSet) is invoked providing a way for
the listener to see what actual entries were removed from the container. |
void |
addSegments(IntSet segments)
Sets what segments this data container should be using.
|
default void |
cleanUp()
Method used to cleanup any pending data, such as evictions
|
void |
clear(IntSet segments)
Removes entries from the container whose key maps to one of the provided segments
|
InternalCacheEntry<K,V> |
compute(int segment,
K key,
DataContainer.ComputeAction<K,V> action)
Same as
DataContainer.compute(Object, ComputeAction) except that the segment of the key can provided to
update entries without calculating the segment for the given key. |
boolean |
containsKey(int segment,
Object k)
Same as
DataContainer.containsKey(Object) except that the segment of the key can provided to
lookup if the entry exists without calculating the segment for the given key. |
CompletionStage<Void> |
evict(int segment,
K key)
Same as
DataContainer.evict(Object) except that the segment of the key can provided to
remove the entry without calculating the segment for the given key. |
default void |
forEach(IntSet segments,
Consumer<? super InternalCacheEntry<K,V>> action)
Performs the given action for each element of the container that maps to the given set of segments
until all elements have been processed or the action throws an exception.
|
InternalCacheEntry<K,V> |
get(int segment,
Object k)
Deprecated.
since 10.1
|
InternalCacheEntry<K,V> |
get(Object k)
Deprecated.
since 10.1
|
Iterator<InternalCacheEntry<K,V>> |
iterator(IntSet segments)
Same as
DataContainer.iterator() except that only entries that map to the provided segments are
returned via the iterator. |
Iterator<InternalCacheEntry<K,V>> |
iteratorIncludingExpired(IntSet segments)
Same as
DataContainer.iteratorIncludingExpired() except that only entries that map to the provided
segments are returned via the iterator. |
InternalCacheEntry<K,V> |
peek(int segment,
Object k)
Same as
DataContainer.peek(Object) except that the segment of the key can provided to lookup entries
without calculating the segment for the given key |
default org.reactivestreams.Publisher<InternalCacheEntry<K,V>> |
publisher(int segment) |
void |
put(int segment,
K k,
V v,
Metadata metadata,
PrivateMetadata internalMetadata,
long createdTimestamp,
long lastUseTimestamp)
Same as
DataContainer.put(Object, Object, Metadata) except that the segment of the key can provided to
write/lookup entries without calculating the segment for the given key. |
InternalCacheEntry<K,V> |
remove(int segment,
Object k)
Same as
DataContainer.remove(Object) except that the segment of the key can provided to
remove the entry without calculating the segment for the given key. |
void |
removeRemovalListener(Object listener)
Removes a previously registered listener via
addRemovalListener(Consumer) . |
void |
removeSegments(IntSet segments)
Removes and un-associates the given segments.
|
default int |
size(IntSet segments)
Returns how many entries are present in the data container that map to the given segments without counting entries
that are currently expired.
|
default int |
sizeIncludingExpired(IntSet segments)
Returns how many entries are present in the data container that map to the given segments including any entries
that may be expired
|
Spliterator<InternalCacheEntry<K,V>> |
spliterator(IntSet segments)
Same as
DataContainer.spliterator() except that only entries that map to the provided segments are
returned via this spliterator. |
Spliterator<InternalCacheEntry<K,V>> |
spliteratorIncludingExpired(IntSet segments)
Same as
DataContainer.spliteratorIncludingExpired() except that only entries that map to the provided
segments are returned via this spliterator. |
boolean |
touch(int segment,
Object k,
long currentTimeMillis)
Touches an entry in the data container.
|
capacity, clear, compute, containsKey, evict, evictionSize, iterator, iteratorIncludingExpired, peek, put, remove, resize, size, sizeIncludingExpired, spliterator, spliteratorIncludingExpired
@Deprecated InternalCacheEntry<K,V> get(Object k)
We should only ever be using the non blocking variant peek(int, Object)
in Infinispan
get
in interface DataContainer<K,V>
k
- key under which entry is stored@Deprecated InternalCacheEntry<K,V> get(int segment, Object k)
DataContainer.get(Object)
except that the segment of the key can provided to lookup entries
without calculating the segment for the given keysegment
- segment for the keyk
- key under which entry is storedInternalCacheEntry<K,V> peek(int segment, Object k)
DataContainer.peek(Object)
except that the segment of the key can provided to lookup entries
without calculating the segment for the given keysegment
- segment for the keyk
- key under which entry is storedboolean touch(int segment, Object k, long currentTimeMillis)
segment
- segment for the keyk
- key under which entry is storedcurrentTimeMillis
- the current time in milliseconds to touch the entry withvoid put(int segment, K k, V v, Metadata metadata, PrivateMetadata internalMetadata, long createdTimestamp, long lastUseTimestamp)
DataContainer.put(Object, Object, Metadata)
except that the segment of the key can provided to
write/lookup entries without calculating the segment for the given key.
Note: The timestamps ignored if the entry already exists in the data container.
segment
- segment for the keyk
- key under which to store entryv
- value to storemetadata
- metadata of the entryinternalMetadata
- createdTimestamp
- creation timestamp, or -1
to use the current timelastUseTimestamp
- last use timestamp, or -1
to use the current timeboolean containsKey(int segment, Object k)
DataContainer.containsKey(Object)
except that the segment of the key can provided to
lookup if the entry exists without calculating the segment for the given key.segment
- segment for the keyk
- key under which entry is storedInternalCacheEntry<K,V> remove(int segment, Object k)
DataContainer.remove(Object)
except that the segment of the key can provided to
remove the entry without calculating the segment for the given key.segment
- segment for the keyk
- key to removeCompletionStage<Void> evict(int segment, K key)
DataContainer.evict(Object)
except that the segment of the key can provided to
remove the entry without calculating the segment for the given key.segment
- segment for the keykey
- The key to evict.InternalCacheEntry<K,V> compute(int segment, K key, DataContainer.ComputeAction<K,V> action)
DataContainer.compute(Object, ComputeAction)
except that the segment of the key can provided to
update entries without calculating the segment for the given key.segment
- segment for the keykey
- The key.action
- The action that will compute the new value.InternalCacheEntry
associated to the key.default int size(IntSet segments)
segments
- segments of entries to countdefault int sizeIncludingExpired(IntSet segments)
segments
- segments of entries to countvoid clear(IntSet segments)
segments
- segments of entries to removeSpliterator<InternalCacheEntry<K,V>> spliterator(IntSet segments)
DataContainer.spliterator()
except that only entries that map to the provided segments are
returned via this spliterator. The spliterator will not return expired entries.segments
- segments of entries to returnSpliterator<InternalCacheEntry<K,V>> spliteratorIncludingExpired(IntSet segments)
DataContainer.spliteratorIncludingExpired()
except that only entries that map to the provided
segments are returned via this spliterator. The spliterator will return expired entries as well.segments
- segments of entries to useIterator<InternalCacheEntry<K,V>> iterator(IntSet segments)
DataContainer.iterator()
except that only entries that map to the provided segments are
returned via the iterator. The iterator will not return expired entries.segments
- segments of entries to useIterator<InternalCacheEntry<K,V>> iteratorIncludingExpired(IntSet segments)
DataContainer.iteratorIncludingExpired()
except that only entries that map to the provided
segments are returned via the iterator. The iterator can return expired entries.segments
- segments of entries to usedefault org.reactivestreams.Publisher<InternalCacheEntry<K,V>> publisher(int segment)
default void forEach(IntSet segments, Consumer<? super InternalCacheEntry<K,V>> action)
action
- The action to be performed for each elementNullPointerException
- if the specified action is nullvoid addSegments(IntSet segments)
segments
- segments to associate with this containervoid removeSegments(IntSet segments)
addRemovalListener(Consumer)
of entries that were removed due to no longer being associated with this
container. There is no guarantee if the consumer is invoked once or multiple times for a given group of segments
and could be in any order.
When this method is invoked an implementation is free to remove any entries that don't map to segments currently
associated with this container. Note that entries that were removed due to their segments never being associated
with this container do not notify listeners registered via addRemovalListener(Consumer)
.
segments
- segments that should no longer be associated with this containervoid addRemovalListener(Consumer<Iterable<InternalCacheEntry<K,V>>> listener)
removeSegments(IntSet)
is invoked providing a way for
the listener to see what actual entries were removed from the container.listener
- listener that invoked of removed entriesvoid removeRemovalListener(Object listener)
addRemovalListener(Consumer)
.listener
- the listener to removedefault void cleanUp()
Copyright © 2021 JBoss by Red Hat. All rights reserved.