Interface InternalExpirationManager<K,V>
-
- All Superinterfaces:
ExpirationManager<K,V>
- All Known Implementing Classes:
ClusterExpirationManager,ExpirationManagerImpl,TxClusterExpirationManager
public interface InternalExpirationManager<K,V> extends ExpirationManager<K,V>
Interface describing the internal operations for the the ExpirationManager.- Since:
- 9.3
- Author:
- wburns
-
-
Nested Class Summary
Nested Classes Modifier and Type Interface Description static interfaceInternalExpirationManager.ExpirationConsumer<T,U>
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Modifier and Type Method Description voidaddInternalListener(InternalExpirationManager.ExpirationConsumer<K,V> consumer)Adds anInternalExpirationManager.ExpirationConsumerto 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.booleanentryExpiredInMemoryFromIteration(InternalCacheEntry<K,V> entry, long currentTime)This method is very similar toentryExpiredInMemory(InternalCacheEntry, long, boolean)except that it does the bare minimum when an entry expired to guarantee if the entry is valid or not.default voidhandleInStoreExpiration(K key)This is to be invoked when a store entry expires.default voidhandleInStoreExpiration(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.voidremoveInternalListener(Object listener)Removes a previous registeredInternalExpirationManager.ExpirationConsumer.-
Methods inherited from interface org.infinispan.expiration.ExpirationManager
handleInMemoryExpiration, isEnabled, processExpiration, registerWriteIncoming, unregisterWrite
-
-
-
-
Method Detail
-
entryExpiredInMemory
CompletableFuture<Boolean> entryExpiredInMemory(InternalCacheEntry<K,V> entry, long currentTime, boolean isWrite)
This should be invoked passing in an entry that is now expired. This method may attempt to lock this key to preserve atomicity. This method should be invoked when an entry was read via get but found to be expired.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.
- Parameters:
entry- the entry that has expiredcurrentTime- the current time when it expiredisWrite- if the expiration was found during a write operation- Returns:
- if this entry actually expired or not
-
entryExpiredInMemoryFromIteration
boolean entryExpiredInMemoryFromIteration(InternalCacheEntry<K,V> entry, long currentTime)
This method is very similar toentryExpiredInMemory(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.- Parameters:
entry- the entry that has expiredcurrentTime- the current time when it expired- Returns:
- if this entry actually expired or not
-
handleInStoreExpirationInternal
CompletionStage<Void> handleInStoreExpirationInternal(K key)
This is to be invoked when a store entry expires. This method may attempt to lock this key to preserve atomicity.Note this method doesn't currently take a
InternalCacheEntryand 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.- Parameters:
key- the key of the expired entry This method will be renamed to handleInStoreExpiration when the method can be removed fromExpirationManager
-
handleInStoreExpiration
default void handleInStoreExpiration(K key)
Description copied from interface:ExpirationManagerThis is to be invoked when a store entry expires. This method may attempt to lock this key to preserve atomicity.Note this method doesn't currently take a
InternalCacheEntryand 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.- Specified by:
handleInStoreExpirationin interfaceExpirationManager<K,V>- Parameters:
key- the key of the expired entry
-
handleInStoreExpirationInternal
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. This method is preferred overExpirationManager.handleInStoreExpiration(Object)as it allows for more specific expiration to possibly occur.- Parameters:
marshalledEntry- the entry that can be unmarshalled as needed This method will be renamed to handleInStoreExpiration when the method can be removed fromExpirationManager
-
handleInStoreExpiration
default void handleInStoreExpiration(MarshallableEntry<K,V> marshalledEntry)
Description copied from interface:ExpirationManagerThis is to be invoked when a store entry expires and the value and/or metadata is available to be used. This method is preferred overExpirationManager.handleInStoreExpiration(Object)as it allows for more specific expiration to possibly occur.- Specified by:
handleInStoreExpirationin interfaceExpirationManager<K,V>- Parameters:
marshalledEntry- the entry that can be unmarshalled as needed
-
handlePossibleExpiration
CompletionStage<Boolean> handlePossibleExpiration(InternalCacheEntry<K,V> entry, int segment, boolean isWrite)
Handles processing for an entry that may be expired. This will remove the entry if it is expired, otherwise may touch if it uses max idle.- Parameters:
entry- entry that may be expiredsegment- the segment of the entryisWrite- whether the command that saw the expired value was a write or not- Returns:
- a stage that will complete with
trueif the entry was expired andfalseotherwise
-
addInternalListener
void addInternalListener(InternalExpirationManager.ExpirationConsumer<K,V> consumer)
Adds anInternalExpirationManager.ExpirationConsumerto be invoked when an entry is expired.It exposes the
PrivateMetadata- Parameters:
consumer- The instance to invoke.
-
removeInternalListener
void removeInternalListener(Object listener)
Removes a previous registeredInternalExpirationManager.ExpirationConsumer.- Parameters:
listener- The instance to remove.
-
-