public final class ExpiryPolicyBuilder<K,V>
extends java.lang.Object
implements org.ehcache.config.Builder<org.ehcache.expiry.ExpiryPolicy<K,V>>
ExpiryPolicy instances.| Modifier and Type | Class and Description |
|---|---|
static interface |
ExpiryPolicyBuilder.TriFunction<T,U,V,R> |
| Modifier and Type | Method and Description |
|---|---|
<K2 extends K,V2 extends V> |
access(java.util.function.BiFunction<K2,java.util.function.Supplier<? extends V2>,java.time.Duration> access)
Set a function giving the TTI since last access.
|
ExpiryPolicyBuilder<K,V> |
access(java.time.Duration access)
Set TTI since last access.
|
org.ehcache.expiry.ExpiryPolicy<K,V> |
build()
Builds an expiry policy instance.
|
<K2 extends K,V2 extends V> |
create(java.util.function.BiFunction<K2,V2,java.time.Duration> create)
Set a function giving the TTL since creation.
|
ExpiryPolicyBuilder<K,V> |
create(java.time.Duration create)
Set TTL since creation.
|
static ExpiryPolicyBuilder<java.lang.Object,java.lang.Object> |
expiry()
Fluent API for creating an
ExpiryPolicy instance where you can specify constant values for creation, access and update time. |
static org.ehcache.expiry.ExpiryPolicy<java.lang.Object,java.lang.Object> |
noExpiration()
Get an
ExpiryPolicy instance for a non expiring (ie. |
static org.ehcache.expiry.ExpiryPolicy<java.lang.Object,java.lang.Object> |
timeToIdleExpiration(java.time.Duration timeToIdle)
Get a time-to-idle (TTI)
ExpiryPolicy instance for the given Duration. |
static org.ehcache.expiry.ExpiryPolicy<java.lang.Object,java.lang.Object> |
timeToLiveExpiration(java.time.Duration timeToLive)
Get a time-to-live (TTL)
ExpiryPolicy instance for the given Duration. |
ExpiryPolicyBuilder<K,V> |
update(java.time.Duration update)
Set TTL since last update.
|
<K2 extends K,V2 extends V> |
update(ExpiryPolicyBuilder.TriFunction<K2,java.util.function.Supplier<? extends V2>,V2,java.time.Duration> update)
Set a function giving the TTL since last update.
|
public static org.ehcache.expiry.ExpiryPolicy<java.lang.Object,java.lang.Object> noExpiration()
ExpiryPolicy instance for a non expiring (ie. "eternal") cache.public static org.ehcache.expiry.ExpiryPolicy<java.lang.Object,java.lang.Object> timeToLiveExpiration(java.time.Duration timeToLive)
ExpiryPolicy instance for the given Duration.timeToLive - the TTL durationpublic static org.ehcache.expiry.ExpiryPolicy<java.lang.Object,java.lang.Object> timeToIdleExpiration(java.time.Duration timeToIdle)
ExpiryPolicy instance for the given Duration.timeToIdle - the TTI durationpublic static ExpiryPolicyBuilder<java.lang.Object,java.lang.Object> expiry()
ExpiryPolicy instance where you can specify constant values for creation, access and update time.
Unspecified values will be set to INFINITE for create and null for access and update, matching
the noExpiration() no expiration} expiry.ExpiryPolicy builderpublic ExpiryPolicyBuilder<K,V> create(java.time.Duration create)
Note: Calling this method on a builder with an existing TTL since creation will override the previous value or function.
create - TTL since creationpublic <K2 extends K,V2 extends V> ExpiryPolicyBuilder<K2,V2> create(java.util.function.BiFunction<K2,V2,java.time.Duration> create)
Note: Calling this method on a builder with an existing TTL since creation will override the previous value or function.
create - Function giving the TTL since creationpublic ExpiryPolicyBuilder<K,V> access(java.time.Duration access)
Note: Calling this method on a builder with an existing TTI since last access will override the previous value or function.
access - TTI since last accesspublic <K2 extends K,V2 extends V> ExpiryPolicyBuilder<K2,V2> access(java.util.function.BiFunction<K2,java.util.function.Supplier<? extends V2>,java.time.Duration> access)
Note: Calling this method on a builder with an existing TTI since last access will override the previous value or function.
access - Function giving the TTI since last accesspublic ExpiryPolicyBuilder<K,V> update(java.time.Duration update)
Note: Calling this method on a builder with an existing TTL since last access will override the previous value or function.
update - TTL since last updatepublic <K2 extends K,V2 extends V> ExpiryPolicyBuilder<K2,V2> update(ExpiryPolicyBuilder.TriFunction<K2,java.util.function.Supplier<? extends V2>,V2,java.time.Duration> update)
Note: Calling this method on a builder with an existing TTL since last update will override the previous value or function.
update - Function giving the TTL since last update