Package io.quarkus.cache.redis.runtime
Class RedisCacheImpl
- java.lang.Object
-
- io.quarkus.cache.runtime.AbstractCache
-
- io.quarkus.cache.redis.runtime.RedisCacheImpl
-
- All Implemented Interfaces:
Cache,RedisCache
public class RedisCacheImpl extends AbstractCache implements RedisCache
This class is an internal Quarkus cache implementation using Redis. Do not use it explicitly from your Quarkus application.
-
-
Field Summary
-
Fields inherited from class io.quarkus.cache.runtime.AbstractCache
NULL_KEYS_NOT_SUPPORTED_MSG
-
-
Constructor Summary
Constructors Constructor Description RedisCacheImpl(RedisCacheInfo cacheInfo, io.vertx.mutiny.core.Vertx vertx, io.vertx.mutiny.redis.client.Redis redis, Supplier<Boolean> blockingAllowedSupplier)RedisCacheImpl(RedisCacheInfo cacheInfo, Optional<String> redisClientName)
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description (package private) StringcomputeActualKey(String key)(package private) ObjectcomputeUserKey(String key)<K,V>
io.smallrye.mutiny.Uni<V>get(K key, Class<V> clazz, Function<K,V> valueLoader)Allows retrieving a value from the Redis cache.<K,V>
io.smallrye.mutiny.Uni<V>getAsync(K key, Class<V> clazz, Function<K,io.smallrye.mutiny.Uni<V>> valueLoader)Allows retrieving a value from the Redis cache.ObjectgetDefaultKey()Class<?>getDefaultValueType()When configured, gets the default type of the value stored in the cache.StringgetName()<K,V>
io.smallrye.mutiny.Uni<V>getOrDefault(K key, V defaultValue)<K,V>
io.smallrye.mutiny.Uni<V>getOrNull(K key, Class<V> clazz)io.smallrye.mutiny.Uni<Void>invalidate(Object key)io.smallrye.mutiny.Uni<Void>invalidateAll()io.smallrye.mutiny.Uni<Void>invalidateIf(Predicate<Object> predicate)<K,V>
io.smallrye.mutiny.Uni<Void>put(K key, Supplier<V> supplier)<K,V>
io.smallrye.mutiny.Uni<Void>put(K key, V value)Put a value in the cache.-
Methods inherited from class io.quarkus.cache.runtime.AbstractCache
as
-
Methods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait
-
Methods inherited from interface io.quarkus.cache.redis.runtime.RedisCache
get, getAsync
-
-
-
-
Constructor Detail
-
RedisCacheImpl
public RedisCacheImpl(RedisCacheInfo cacheInfo, Optional<String> redisClientName)
-
RedisCacheImpl
public RedisCacheImpl(RedisCacheInfo cacheInfo, io.vertx.mutiny.core.Vertx vertx, io.vertx.mutiny.redis.client.Redis redis, Supplier<Boolean> blockingAllowedSupplier)
-
-
Method Detail
-
getDefaultKey
public Object getDefaultKey()
- Specified by:
getDefaultKeyin interfaceCache- Overrides:
getDefaultKeyin classAbstractCache
-
getDefaultValueType
public Class<?> getDefaultValueType()
Description copied from interface:RedisCacheWhen configured, gets the default type of the value stored in the cache. The configured type is used when no type is passed into theRedisCache.get(Object, Class, Function).- Specified by:
getDefaultValueTypein interfaceRedisCache- Returns:
- the type,
nullif not configured.
-
get
public <K,V> io.smallrye.mutiny.Uni<V> get(K key, Class<V> clazz, Function<K,V> valueLoader)Description copied from interface:RedisCacheAllows retrieving a value from the Redis cache.- Specified by:
getin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keyclazz- the class of the valuevalueLoader- the value loader called when there is no value stored in the cache- Returns:
- the Uni emitting the cached value.
-
getAsync
public <K,V> io.smallrye.mutiny.Uni<V> getAsync(K key, Class<V> clazz, Function<K,io.smallrye.mutiny.Uni<V>> valueLoader)Description copied from interface:RedisCacheAllows retrieving a value from the Redis cache.- Specified by:
getAsyncin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keyclazz- the class of the valuevalueLoader- the value loader called when there is no value stored in the cache- Returns:
- the Uni emitting the cached value.
-
put
public <K,V> io.smallrye.mutiny.Uni<Void> put(K key, V value)
Description copied from interface:RedisCachePut a value in the cache.- Specified by:
putin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keyvalue- the value- Returns:
- a Uni emitting
nullwhen the operation completes
-
put
public <K,V> io.smallrye.mutiny.Uni<Void> put(K key, Supplier<V> supplier)
- Specified by:
putin interfaceRedisCache
-
getOrDefault
public <K,V> io.smallrye.mutiny.Uni<V> getOrDefault(K key, V defaultValue)- Specified by:
getOrDefaultin interfaceRedisCache
-
getOrNull
public <K,V> io.smallrye.mutiny.Uni<V> getOrNull(K key, Class<V> clazz)- Specified by:
getOrNullin interfaceRedisCache
-
invalidate
public io.smallrye.mutiny.Uni<Void> invalidate(Object key)
- Specified by:
invalidatein interfaceCache
-
invalidateAll
public io.smallrye.mutiny.Uni<Void> invalidateAll()
- Specified by:
invalidateAllin interfaceCache
-
invalidateIf
public io.smallrye.mutiny.Uni<Void> invalidateIf(Predicate<Object> predicate)
- Specified by:
invalidateIfin interfaceCache
-
-