Class ProtobufRedisLoadingCache.Factory
- java.lang.Object
-
- org.curioswitch.common.server.framework.redis.ProtobufRedisLoadingCache.Factory
-
- Enclosing class:
- ProtobufRedisLoadingCache<K extends com.google.protobuf.Message,V extends com.google.protobuf.Message>
@Singleton public static class ProtobufRedisLoadingCache.Factory extends java.lang.Object
AProtobufRedisLoadingCache.Factory
for creatingProtobufRedisLoadingCache
.
-
-
Constructor Summary
Constructors Constructor Description Factory(dagger.Lazy<io.lettuce.core.cluster.RedisClusterClient> redisClusterClient, dagger.Lazy<io.lettuce.core.RedisClient> redisClient, RedisConfig config, io.micrometer.core.instrument.MeterRegistry meterRegistry)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <K extends com.google.protobuf.Message,V extends com.google.protobuf.Message>
ProtobufRedisLoadingCache<K,V>create(java.lang.String name, K keyPrototype, V valuePrototype, java.time.Duration redisTtl, boolean redisMasterOnly, com.github.benmanes.caffeine.cache.CaffeineSpec localCacheSpec)
Constructs a newProtobufRedisLoadingCache
that can write protobufMessage
keys and values to remoteCache, with an optional local cache layer.<K extends com.google.protobuf.Message,V extends com.google.protobuf.Message>
ProtobufRedisLoadingCache<K,V>create(java.lang.String name, K keyPrototype, V valuePrototype, java.time.Duration redisTtl, com.github.benmanes.caffeine.cache.CaffeineSpec localCacheSpec)
Constructs a newProtobufRedisLoadingCache
that can write protobufMessage
keys and values to remoteCache, with an optional local cache layer.
-
-
-
Constructor Detail
-
Factory
@Inject public Factory(dagger.Lazy<io.lettuce.core.cluster.RedisClusterClient> redisClusterClient, dagger.Lazy<io.lettuce.core.RedisClient> redisClient, RedisConfig config, io.micrometer.core.instrument.MeterRegistry meterRegistry)
-
-
Method Detail
-
create
public <K extends com.google.protobuf.Message,V extends com.google.protobuf.Message> ProtobufRedisLoadingCache<K,V> create(java.lang.String name, K keyPrototype, V valuePrototype, java.time.Duration redisTtl, @Nullable com.github.benmanes.caffeine.cache.CaffeineSpec localCacheSpec)
Constructs a newProtobufRedisLoadingCache
that can write protobufMessage
keys and values to remoteCache, with an optional local cache layer.- Parameters:
name
- name of this cache, will be prefixed onto all keys.keyPrototype
- a prototype for the keyMessage
, usually gotten fromKey.getDefaultInstance()
.valuePrototype
- a prototype for the valueMessage
, usually gotten fromValue.getDefaultInstance()
.redisTtl
- the time until expiration of a value in the remoteCache cache. The local cache should be considered in localCacheSpec.localCacheSpec
- aCaffeineSpec
to control the local cache layer. Ifnull
, local caching will be disabled.
-
create
public <K extends com.google.protobuf.Message,V extends com.google.protobuf.Message> ProtobufRedisLoadingCache<K,V> create(java.lang.String name, K keyPrototype, V valuePrototype, java.time.Duration redisTtl, boolean redisMasterOnly, @Nullable com.github.benmanes.caffeine.cache.CaffeineSpec localCacheSpec)
Constructs a newProtobufRedisLoadingCache
that can write protobufMessage
keys and values to remoteCache, with an optional local cache layer.- Parameters:
name
- name of this cache, will be prefixed onto all keys.keyPrototype
- a prototype for the keyMessage
, usually gotten fromKey.getDefaultInstance()
.valuePrototype
- a prototype for the valueMessage
, usually gotten fromValue.getDefaultInstance()
.redisTtl
- the time until expiration of a value in the remoteCache cache. The local cache should be considered in localCacheSpec.redisMasterOnly
- whether remoteCache reads should only happen from master. Best-effort, temporary persistent storage should set this totrue
.localCacheSpec
- aCaffeineSpec
to control the local cache layer. Ifnull
, local caching will be disabled.
-
-