public interface InternalExpirationManager<K,V> extends ExpirationManager<K,V>
Modifier and Type | Interface and Description |
---|---|
static interface |
InternalExpirationManager.ExpirationConsumer<T,U> |
Modifier and Type | Method and Description |
---|---|
void |
addInternalListener(InternalExpirationManager.ExpirationConsumer<K,V> consumer)
Adds an
InternalExpirationManager.ExpirationConsumer to be invoked when an entry is expired. |
CompletableFuture<Boolean> |
entryExpiredInMemory(InternalCacheEntry<K,V> entry,
long currentTime,
boolean isWrite)
This should be invoked passing in an entry that is now expired.
|
boolean |
entryExpiredInMemoryFromIteration(InternalCacheEntry<K,V> entry,
long currentTime)
This method is very similar to
entryExpiredInMemory(InternalCacheEntry, long, boolean) except that it does the
bare minimum when an entry expired to guarantee if the entry is valid or not. |
default void |
handleInStoreExpiration(K key)
This is to be invoked when a store entry expires.
|
default void |
handleInStoreExpiration(MarshallableEntry<K,V> marshalledEntry)
This is to be invoked when a store entry expires and the value and/or metadata is available to be used.
|
CompletionStage<Void> |
handleInStoreExpirationInternal(K key)
This is to be invoked when a store entry expires.
|
CompletionStage<Void> |
handleInStoreExpirationInternal(MarshallableEntry<K,V> marshalledEntry)
This is to be invoked when a store entry expires and the value and/or metadata is available to be used.
|
CompletionStage<Boolean> |
handlePossibleExpiration(InternalCacheEntry<K,V> entry,
int segment,
boolean isWrite)
Handles processing for an entry that may be expired.
|
void |
removeInternalListener(Object listener)
Removes a previous registered
InternalExpirationManager.ExpirationConsumer . |
handleInMemoryExpiration, isEnabled, processExpiration, registerWriteIncoming, unregisterWrite
CompletableFuture<Boolean> entryExpiredInMemory(InternalCacheEntry<K,V> entry, long currentTime, boolean isWrite)
This method returns true if the entry was removed due to expiration or false if the entry was not removed due to expiration
If hasLock is true, this method assumes that the caller has the lock for the key and it must allow the expiration to occur, ie. returned CompletableFuture has completed, before the lock is released. Failure to do so may cause inconsistency in data.
entry
- the entry that has expiredcurrentTime
- the current time when it expiredisWrite
- if the expiration was found during a write operationboolean entryExpiredInMemoryFromIteration(InternalCacheEntry<K,V> entry, long currentTime)
entryExpiredInMemory(InternalCacheEntry, long, boolean)
except that it does the
bare minimum when an entry expired to guarantee if the entry is valid or not. This is important to reduce time
spent per entry when iterating. This method may not actually remove the entry and may just return immediately
if it is safe to do so.entry
- the entry that has expiredcurrentTime
- the current time when it expiredCompletionStage<Void> handleInStoreExpirationInternal(K key)
Note this method doesn't currently take a InternalCacheEntry
and this is due to a limitation in the
cache store API. This may cause some values to be removed if they were updated at the same time.
key
- the key of the expired entry
This method will be renamed to handleInStoreExpiration when the method can be removed from ExpirationManager
default void handleInStoreExpiration(K key)
ExpirationManager
Note this method doesn't currently take a InternalCacheEntry
and this is due to a limitation in the
cache store API. This may cause some values to be removed if they were updated at the same time.
handleInStoreExpiration
in interface ExpirationManager<K,V>
key
- the key of the expired entryCompletionStage<Void> handleInStoreExpirationInternal(MarshallableEntry<K,V> marshalledEntry)
ExpirationManager.handleInStoreExpiration(Object)
as it allows for more
specific expiration to possibly occur.marshalledEntry
- the entry that can be unmarshalled as needed
This method will be renamed to handleInStoreExpiration when the method can be removed from ExpirationManager
default void handleInStoreExpiration(MarshallableEntry<K,V> marshalledEntry)
ExpirationManager
ExpirationManager.handleInStoreExpiration(Object)
as it allows for more
specific expiration to possibly occur.handleInStoreExpiration
in interface ExpirationManager<K,V>
marshalledEntry
- the entry that can be unmarshalled as neededCompletionStage<Boolean> handlePossibleExpiration(InternalCacheEntry<K,V> entry, int segment, boolean isWrite)
entry
- entry that may be expiredsegment
- the segment of the entryisWrite
- whether the command that saw the expired value was a write or nottrue
if the entry was expired and false
otherwisevoid addInternalListener(InternalExpirationManager.ExpirationConsumer<K,V> consumer)
InternalExpirationManager.ExpirationConsumer
to be invoked when an entry is expired.
It exposes the PrivateMetadata
consumer
- The instance to invoke.void removeInternalListener(Object listener)
InternalExpirationManager.ExpirationConsumer
.listener
- The instance to remove.Copyright © 2021 JBoss by Red Hat. All rights reserved.