public static enum PersistentDataStoreBuilder.StaleValuesPolicy extends java.lang.Enum<PersistentDataStoreBuilder.StaleValuesPolicy>
PersistentDataStoreBuilder.staleValuesPolicy(StaleValuesPolicy)
.Enum Constant and Description |
---|
EVICT
Indicates that when the cache TTL expires for an item, it is evicted from the cache.
|
REFRESH
Indicates that the cache should refresh stale values instead of evicting them.
|
REFRESH_ASYNC
Indicates that the cache should refresh stale values asynchronously instead of evicting them.
|
Modifier and Type | Method and Description |
---|---|
static PersistentDataStoreBuilder.StaleValuesPolicy |
valueOf(java.lang.String name)
Returns the enum constant of this type with the specified name.
|
static PersistentDataStoreBuilder.StaleValuesPolicy[] |
values()
Returns an array containing the constants of this enum type, in
the order they are declared.
|
public static final PersistentDataStoreBuilder.StaleValuesPolicy EVICT
CacheBuilder.expireAfterWrite(long, TimeUnit)
public static final PersistentDataStoreBuilder.StaleValuesPolicy REFRESH
In this mode, an attempt to read an expired item causes a synchronous read from the underlying
data store, like EVICT
--but if an error occurs during this refresh, the cache will
continue to return the previously cached values (if any). This is useful if you prefer the most
recently cached feature rule set to be returned for evaluation over the default value when
updates go wrong.
See: CacheBuilder
for more specific information on cache semantics. This mode is equivalent to expireAfterWrite
.
public static final PersistentDataStoreBuilder.StaleValuesPolicy REFRESH_ASYNC
This is the same as REFRESH
, except that the attempt to refresh the value is done
on another thread (using a Executor
). In the meantime, the cache
will continue to return the previously cached value (if any) in a non-blocking fashion to threads
requesting the stale key. Any exception encountered during the asynchronous reload will cause
the previously cached value to be retained.
This setting is ideal to enable when you desire high performance reads and can accept returning stale values for the period of the async refresh. For example, configuring this feature store with a very low cache time and enabling this feature would see great performance benefit by decoupling calls from network I/O.
See: CacheBuilder for more specific information on cache semantics.
public static PersistentDataStoreBuilder.StaleValuesPolicy[] values()
for (PersistentDataStoreBuilder.StaleValuesPolicy c : PersistentDataStoreBuilder.StaleValuesPolicy.values()) System.out.println(c);
public static PersistentDataStoreBuilder.StaleValuesPolicy valueOf(java.lang.String name)
name
- the name of the enum constant to be returned.java.lang.IllegalArgumentException
- if this enum type has no constant with the specified namejava.lang.NullPointerException
- if the argument is null