Package org.infinispan.expiration
Interface ExpirationManager<K,V>
-
@ThreadSafe public interface ExpirationManager<K,V>
Central component that deals with expiration of cache entries. Typically,processExpiration()
is called periodically by the expiration thread (which can be configured usingExpirationConfigurationBuilder.wakeUpInterval(long)
andGlobalConfigurationBuilder.expirationThreadPool()
). If the expiration thread is disabled - by settingExpirationConfigurationBuilder.wakeUpInterval(long)
to 0 - then this method could be called directly, perhaps by any other maintenance thread that runs periodically in the application.- Since:
- 7.2
- Author:
- William Burns
-
-
Method Summary
All Methods Instance Methods Abstract Methods Default Methods Deprecated Methods Modifier and Type Method Description void
handleInMemoryExpiration(InternalCacheEntry<K,V> entry, long currentTime)
Deprecated.since 9.3 this method is not intended for external usevoid
handleInStoreExpiration(K key)
Deprecated.since 9.3 this method is not intended for external usevoid
handleInStoreExpiration(MarshallableEntry<K,V> marshalledEntry)
Deprecated.since 9.3 this method is not intended for external useboolean
isEnabled()
void
processExpiration()
Processes the expiration event queue.default void
registerWriteIncoming(K key)
Deprecated.since 9.3 There is no reason for this method and is implementation specificjava.util.concurrent.CompletableFuture<java.lang.Long>
retrieveLastAccess(java.lang.Object key, java.lang.Object value, int segment)
Deprecated.since 9.3 this method is not intended for external usedefault void
unregisterWrite(K key)
Deprecated.since 9.3 There is no reason for this method and is implementation specific
-
-
-
Method Detail
-
processExpiration
void processExpiration()
Processes the expiration event queue.
-
isEnabled
boolean isEnabled()
- Returns:
- true if expiration reaper thread is enabled, false otherwise
-
handleInMemoryExpiration
@Deprecated void handleInMemoryExpiration(InternalCacheEntry<K,V> entry, long currentTime)
Deprecated.since 9.3 this method is not intended for external useThis should be invoked passing in an entry that is now expired. This method may attempt to lock this key to preserve atomicity.- Parameters:
entry
- entry that is now expiredcurrentTime
- the current time in milliseconds
-
handleInStoreExpiration
@Deprecated void handleInStoreExpiration(K key)
Deprecated.since 9.3 this method is not intended for external useThis 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
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.- Parameters:
key
- the key of the expired entry
-
handleInStoreExpiration
@Deprecated void handleInStoreExpiration(MarshallableEntry<K,V> marshalledEntry)
Deprecated.since 9.3 this method is not intended for external useThis is to be invoked when a store entry expires and the value and/or metadata is available to be used. This method is preferred overhandleInStoreExpiration(Object)
as it allows for more specific expiration to possibly occur.- Parameters:
marshalledEntry
- the entry that can be unmarshalled as needed
-
retrieveLastAccess
@Deprecated java.util.concurrent.CompletableFuture<java.lang.Long> retrieveLastAccess(java.lang.Object key, java.lang.Object value, int segment)
Deprecated.since 9.3 this method is not intended for external useRetrieves the last access time for the given key in the data container if it is using max idle. If the entry is not in the container or it is expired it will return null. If the entry is present but cannot expire via max idle, it will return -1 If the entry is present and can expire via max idle but hasn't it will return a number > 0- Parameters:
key
- the key to retrieve the access time forvalue
- the value to match if desired (this can be null)segment
- the segment for the given key- Returns:
- the last access time if available
-
registerWriteIncoming
@Deprecated default void registerWriteIncoming(K key)
Deprecated.since 9.3 There is no reason for this method and is implementation specificThis is to be invoked with a when a write is known to occur to prevent expiration from happening. This way we won't have a swarm of remote calls required.- Parameters:
key
- the key to use
-
unregisterWrite
@Deprecated default void unregisterWrite(K key)
Deprecated.since 9.3 There is no reason for this method and is implementation specificThis should always be invoked after registering write but after performing any operations required.- Parameters:
key
- the key to use
-
-