public class FlagsmithCacheConfig.FlagsmithCacheImpl extends Object implements FlagsmithCache
| Constructor and Description |
|---|
FlagsmithCacheImpl(com.github.benmanes.caffeine.cache.Cache<String,Flags> cache) |
FlagsmithCacheImpl(com.github.benmanes.caffeine.cache.Cache<String,Flags> cache,
String envFlagsCacheKey) |
| Modifier and Type | Method and Description |
|---|---|
void |
cleanUp()
Performs any pending maintenance operations needed by the cache.
|
long |
estimatedSize()
Returns the approximate number of entries in this cache.
|
com.github.benmanes.caffeine.cache.Cache<String,Flags> |
getCache()
Returns the Cache instance.
|
String |
getEnvFlagsCacheKey()
Returns the environment level flags/traits cache key.
|
String |
getIdentityFlagsCacheKey(String identifier)
Returns the cache key for a given identity.
|
Flags |
getIfPresent(String key)
Returns the value associated with key in this cache, or null if there is no cached value for
key.
|
void |
invalidate(String userId)
Discards any cached value for key userId.
|
void |
invalidateAll()
Discards all entries in the cache.
|
com.github.benmanes.caffeine.cache.stats.CacheStats |
stats()
Returns a current snapshot of this cache's cumulative statistics.
|
public FlagsmithCacheImpl(com.github.benmanes.caffeine.cache.Cache<String,Flags> cache, String envFlagsCacheKey)
public void cleanUp()
FlagsmithCachecleanUp in interface FlagsmithCachepublic void invalidateAll()
FlagsmithCacheinvalidateAll in interface FlagsmithCachepublic void invalidate(String userId)
FlagsmithCacheinvalidate in interface FlagsmithCacheuserId - an id of the userpublic long estimatedSize()
FlagsmithCacheestimatedSize in interface FlagsmithCachepublic com.github.benmanes.caffeine.cache.stats.CacheStats stats()
FlagsmithCachestats in interface FlagsmithCachepublic Flags getIfPresent(String key)
FlagsmithCachegetIfPresent in interface FlagsmithCachekey - a key to retrieve value forpublic String getEnvFlagsCacheKey()
FlagsmithCacheFlags for users are stored in the cache using the user-identifier as the cache key.
For environment level flags, you need to configure a key with the builder to enable caching environment flags.
This method returns the key you configured with the builder.
getEnvFlagsCacheKey in interface FlagsmithCachepublic String getIdentityFlagsCacheKey(String identifier)
FlagsmithCachegetIdentityFlagsCacheKey in interface FlagsmithCachepublic com.github.benmanes.caffeine.cache.Cache<String,Flags> getCache()
FlagsmithCachegetCache in interface FlagsmithCacheCopyright © 2023. All rights reserved.