PersistentDataStoreBuilder
interface.@Deprecated
public final class FeatureStoreCacheConfig
extends java.lang.Object
FeatureStore
implementations that support local caching.
If a store implementation uses this class, then it is using the standard caching mechanism that
is built into the SDK, and is guaranteed to support all the properties defined in this class.
This is an immutable class that uses a fluent interface. Obtain an instance by calling the static
methods disabled()
or enabled()
; then, if desired, you can use chained methods
to set other properties:
Components.redisFeatureStore()
.caching(
FeatureStoreCacheConfig.enabled()
.ttlSeconds(30)
.staleValuesPolicy(FeatureStoreCacheConfig.StaleValuesPolicy.REFRESH)
)
RedisFeatureStoreBuilder.caching(FeatureStoreCacheConfig)
Modifier and Type | Class and Description |
---|---|
static class |
FeatureStoreCacheConfig.StaleValuesPolicy
Deprecated.
Possible values for
staleValuesPolicy(StaleValuesPolicy) . |
Modifier and Type | Field and Description |
---|---|
static FeatureStoreCacheConfig |
DEFAULT
Deprecated.
The caching parameters that feature store should use by default.
|
static long |
DEFAULT_TIME_SECONDS
Deprecated.
The default TTL, in seconds, used by
DEFAULT . |
Modifier and Type | Method and Description |
---|---|
static FeatureStoreCacheConfig |
disabled()
Deprecated.
Returns a parameter object indicating that caching should be disabled.
|
static FeatureStoreCacheConfig |
enabled()
Deprecated.
Returns a parameter object indicating that caching should be enabled, using the default TTL of
DEFAULT_TIME_SECONDS . |
boolean |
equals(java.lang.Object other)
Deprecated.
|
long |
getCacheTime()
Deprecated.
Returns the cache TTL.
|
long |
getCacheTimeMillis()
Deprecated.
Returns the cache TTL converted to milliseconds.
|
java.util.concurrent.TimeUnit |
getCacheTimeUnit()
Deprecated.
Returns the time unit for the cache TTL.
|
FeatureStoreCacheConfig.StaleValuesPolicy |
getStaleValuesPolicy()
Deprecated.
Returns the
FeatureStoreCacheConfig.StaleValuesPolicy setting. |
int |
hashCode()
Deprecated.
|
boolean |
isEnabled()
Deprecated.
Returns true if caching will be enabled.
|
boolean |
isInfiniteTtl()
Deprecated.
Returns true if caching is enabled and does not have a finite TTL.
|
FeatureStoreCacheConfig |
staleValuesPolicy(FeatureStoreCacheConfig.StaleValuesPolicy policy)
Deprecated.
Specifies how the cache (if any) should deal with old values when the cache TTL expires.
|
FeatureStoreCacheConfig |
ttl(long cacheTime,
java.util.concurrent.TimeUnit timeUnit)
Deprecated.
Specifies the cache TTL.
|
FeatureStoreCacheConfig |
ttlMillis(long millis)
Deprecated.
Shortcut for calling
ttl(long, TimeUnit) with TimeUnit.MILLISECONDS . |
FeatureStoreCacheConfig |
ttlSeconds(long seconds)
Deprecated.
Shortcut for calling
ttl(long, TimeUnit) with TimeUnit.SECONDS . |
public static final long DEFAULT_TIME_SECONDS
DEFAULT
.public static final FeatureStoreCacheConfig DEFAULT
DEFAULT_TIME_SECONDS
and the FeatureStoreCacheConfig.StaleValuesPolicy.EVICT
policy.public static FeatureStoreCacheConfig disabled()
FeatureStoreCacheConfig
instancepublic static FeatureStoreCacheConfig enabled()
DEFAULT_TIME_SECONDS
. You can further modify the cache properties using the other
methods of this class.FeatureStoreCacheConfig
instancepublic boolean isEnabled()
public boolean isInfiniteTtl()
public long getCacheTime()
If the value is zero, caching is disabled.
If the value is negative, data is cached forever (i.e. it will only be read again from the database if the SDK is restarted). Use the "cached forever" mode with caution: it means that in a scenario where multiple processes are sharing the database, and the current process loses connectivity to LaunchDarkly while other processes are still receiving updates and writing them to the database, the current process will have stale data.
getCacheTimeUnit()
public java.util.concurrent.TimeUnit getCacheTimeUnit()
public long getCacheTimeMillis()
If the value is zero, caching is disabled.
If the value is negative, data is cached forever (i.e. it will only be read again from the database if the SDK is restarted). Use the "cached forever" mode with caution: it means that in a scenario where multiple processes are sharing the database, and the current process loses connectivity to LaunchDarkly while other processes are still receiving updates and writing them to the database, the current process will have stale data.
public FeatureStoreCacheConfig.StaleValuesPolicy getStaleValuesPolicy()
FeatureStoreCacheConfig.StaleValuesPolicy
setting.public FeatureStoreCacheConfig ttl(long cacheTime, java.util.concurrent.TimeUnit timeUnit)
staleValuesPolicy(StaleValuesPolicy)
)
after this amount of time from the time when they were originally cached. If the time is less
than or equal to zero, caching is disabled.
after this amount of time from the time when they were originally cached.
If the value is zero, caching is disabled.
If the value is negative, data is cached forever (i.e. it will only be read again from the database if the SDK is restarted). Use the "cached forever" mode with caution: it means that in a scenario where multiple processes are sharing the database, and the current process loses connectivity to LaunchDarkly while other processes are still receiving updates and writing them to the database, the current process will have stale data.
cacheTime
- the cache TTL in whatever units you wishtimeUnit
- the time unitpublic FeatureStoreCacheConfig ttlMillis(long millis)
ttl(long, TimeUnit)
with TimeUnit.MILLISECONDS
.millis
- the cache TTL in millisecondspublic FeatureStoreCacheConfig ttlSeconds(long seconds)
ttl(long, TimeUnit)
with TimeUnit.SECONDS
.seconds
- the cache TTL in secondspublic FeatureStoreCacheConfig staleValuesPolicy(FeatureStoreCacheConfig.StaleValuesPolicy policy)
FeatureStoreCacheConfig.StaleValuesPolicy.EVICT
. This property has no effect if caching is disabled.policy
- a FeatureStoreCacheConfig.StaleValuesPolicy
constantpublic boolean equals(java.lang.Object other)
equals
in class java.lang.Object
public int hashCode()
hashCode
in class java.lang.Object