Class CacheFactory.ExpiryAdapter<K,V>
- java.lang.Object
-
- com.github.benmanes.caffeine.jcache.CacheFactory.ExpiryAdapter<K,V>
-
- Enclosing class:
- CacheFactory
private static final class CacheFactory.ExpiryAdapter<K,V> extends java.lang.Object implements Expiry<K,Expirable<V>>
-
-
Constructor Summary
Constructors Constructor Description ExpiryAdapter(Expiry<K,V> expiry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description long
expireAfterCreate(K key, Expirable<V> expirable, long currentTime)
Specifies that the entry should be automatically removed from the cache once the duration has elapsed after the entry's creation.long
expireAfterRead(K key, Expirable<V> expirable, long currentTime, long currentDuration)
Specifies that the entry should be automatically removed from the cache once the duration has elapsed after its last read.long
expireAfterUpdate(K key, Expirable<V> expirable, long currentTime, long currentDuration)
Specifies that the entry should be automatically removed from the cache once the duration has elapsed after the replacement of its value.
-
-
-
Method Detail
-
expireAfterCreate
public long expireAfterCreate(K key, Expirable<V> expirable, long currentTime)
Description copied from interface:Expiry
Specifies that the entry should be automatically removed from the cache once the duration has elapsed after the entry's creation. To indicate no expiration an entry may be given an excessively long period, such asLong#MAX_VALUE
.Note: The
currentTime
is supplied by the configuredTicker
and by default does not relate to system or wall-clock time. When calculating the duration based on a time stamp, the current time should be obtained independently.- Specified by:
expireAfterCreate
in interfaceExpiry<K,V>
- Parameters:
key
- the key represented by this entryexpirable
- the value represented by this entrycurrentTime
- the current time, in nanoseconds- Returns:
- the length of time before the entry expires, in nanoseconds
-
expireAfterUpdate
public long expireAfterUpdate(K key, Expirable<V> expirable, long currentTime, long currentDuration)
Description copied from interface:Expiry
Specifies that the entry should be automatically removed from the cache once the duration has elapsed after the replacement of its value. To indicate no expiration an entry may be given an excessively long period, such asLong#MAX_VALUE
. ThecurrentDuration
may be returned to not modify the expiration time.Note: The
currentTime
is supplied by the configuredTicker
and by default does not relate to system or wall-clock time. When calculating the duration based on a time stamp, the current time should be obtained independently.- Specified by:
expireAfterUpdate
in interfaceExpiry<K,V>
- Parameters:
key
- the key represented by this entryexpirable
- the value represented by this entrycurrentTime
- the current time, in nanosecondscurrentDuration
- the current duration, in nanoseconds- Returns:
- the length of time before the entry expires, in nanoseconds
-
expireAfterRead
public long expireAfterRead(K key, Expirable<V> expirable, long currentTime, long currentDuration)
Description copied from interface:Expiry
Specifies that the entry should be automatically removed from the cache once the duration has elapsed after its last read. To indicate no expiration an entry may be given an excessively long period, such asLong#MAX_VALUE
. ThecurrentDuration
may be returned to not modify the expiration time.Note: The
currentTime
is supplied by the configuredTicker
and by default does not relate to system or wall-clock time. When calculating the duration based on a time stamp, the current time should be obtained independently.- Specified by:
expireAfterRead
in interfaceExpiry<K,V>
- Parameters:
key
- the key represented by this entryexpirable
- the value represented by this entrycurrentTime
- the current time, in nanosecondscurrentDuration
- the current duration, in nanoseconds- Returns:
- the length of time before the entry expires, in nanoseconds
-
-