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:
io.quarkus.cache.Cache,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
ConstructorsConstructorDescriptionRedisCacheImpl(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
Modifier and TypeMethodDescriptioncomputeActualKey(String key) (package private) ObjectcomputeUserKey(String key) <K,V> io.smallrye.mutiny.Uni <V> Allows retrieving a value from the Redis cache.<K,V> io.smallrye.mutiny.Uni <V> Allows retrieving a value from the Redis cache.<K,V> io.smallrye.mutiny.Uni <V> <K,V> io.smallrye.mutiny.Uni <V> getAsync(K key, jakarta.enterprise.util.TypeLiteral<V> type, Function<K, io.smallrye.mutiny.Uni<V>> valueLoader) Allows retrieving a value from the Redis cache.<K,V> io.smallrye.mutiny.Uni <V> Allows retrieving a value from the Redis cache.<K,V> io.smallrye.mutiny.Uni <V> Class<?> When configured, gets the default type of the value stored in the cache.getName()<K,V> io.smallrye.mutiny.Uni <V> getOrDefault(K key, jakarta.enterprise.util.TypeLiteral<V> type, V defaultValue) ReturnsUnithat completes with a value present in the cache under the givenkey.<K,V> io.smallrye.mutiny.Uni <V> getOrDefault(K key, Class<V> clazz, V defaultValue) ReturnsUnithat completes with a value present in the cache under the givenkey.<K,V> io.smallrye.mutiny.Uni <V> getOrDefault(K key, V defaultValue) ReturnsUnithat completes with a value present in the cache under the givenkey.<K,V> io.smallrye.mutiny.Uni <V> getOrNull(K key) ReturnsUnithat completes with a value present in the cache under the givenkey.<K,V> io.smallrye.mutiny.Uni <V> getOrNull(K key, jakarta.enterprise.util.TypeLiteral<V> type) ReturnsUnithat completes with a value present in the cache under the givenkey.<K,V> io.smallrye.mutiny.Uni <V> ReturnsUnithat completes with a value present in the cache under the givenkey.io.smallrye.mutiny.Uni<Void> invalidate(Object key) io.smallrye.mutiny.Uni<Void> io.smallrye.mutiny.Uni<Void> invalidateIf(Predicate<Object> predicate) <K,V> io.smallrye.mutiny.Uni <Void> Put a value in the cache.<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
asMethods inherited from class java.lang.Object
clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, waitMethods inherited from interface io.quarkus.cache.Cache
as
-
Constructor Details
-
RedisCacheImpl
-
RedisCacheImpl
public RedisCacheImpl(RedisCacheInfo cacheInfo, io.vertx.mutiny.core.Vertx vertx, io.vertx.mutiny.redis.client.Redis redis, Supplier<Boolean> blockingAllowedSupplier)
-
-
Method Details
-
getName
- Specified by:
getNamein interfaceio.quarkus.cache.Cache
-
getDefaultKey
- Specified by:
getDefaultKeyin interfaceio.quarkus.cache.Cache- Overrides:
getDefaultKeyin classio.quarkus.cache.runtime.AbstractCache
-
getDefaultValueType
Description copied from interface:RedisCacheWhen configured, gets the default type of the value stored in the cache. The configured type is used in methodsRedisCache.get(Object, Function),RedisCache.getAsync(Object, Function),RedisCache.getOrDefault(Object, Object)andRedisCache.getOrNull(Object).- Specified by:
getDefaultValueTypein interfaceRedisCache- Returns:
- the type,
nullif not configured or if not aClass.
-
get
- Specified by:
getin interfaceio.quarkus.cache.Cache- Specified by:
getin interfaceRedisCache
-
get
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.
-
get
public <K,V> io.smallrye.mutiny.Uni<V> get(K key, jakarta.enterprise.util.TypeLiteral<V> type, 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 keytype- the type 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, Function<K, io.smallrye.mutiny.Uni<V>> valueLoader) - Specified by:
getAsyncin interfaceio.quarkus.cache.Cache- Specified by:
getAsyncin interfaceRedisCache
-
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.
-
getAsync
public <K,V> io.smallrye.mutiny.Uni<V> getAsync(K key, jakarta.enterprise.util.TypeLiteral<V> type, 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 keytype- the type of the valuevalueLoader- the value loader called when there is no value stored in the cache- Returns:
- the Uni emitting the cached value.
-
put
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
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 keysupplier- supplier of the value- Returns:
- a Uni emitting
nullwhen the operation completes
-
getOrDefault
public <K,V> io.smallrye.mutiny.Uni<V> getOrDefault(K key, V defaultValue) Description copied from interface:RedisCacheReturnsUnithat completes with a value present in the cache under the givenkey. If there is no value in the cache under the key, theUnicompletes with the givendefaultValue.- Specified by:
getOrDefaultin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keydefaultValue- the default value- Returns:
- a Uni emitting the value cached under
key, ordefaultValueif there is no cached value
-
getOrDefault
Description copied from interface:RedisCacheReturnsUnithat completes with a value present in the cache under the givenkey. If there is no value in the cache under the key, theUnicompletes with the givendefaultValue.- Specified by:
getOrDefaultin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keyclazz- class of the valuedefaultValue- the default value- Returns:
- a Uni emitting the value cached under
key, ordefaultValueif there is no cached value
-
getOrDefault
public <K,V> io.smallrye.mutiny.Uni<V> getOrDefault(K key, jakarta.enterprise.util.TypeLiteral<V> type, V defaultValue) Description copied from interface:RedisCacheReturnsUnithat completes with a value present in the cache under the givenkey. If there is no value in the cache under the key, theUnicompletes with the givendefaultValue.- Specified by:
getOrDefaultin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keytype- type of the valuedefaultValue- the default value- Returns:
- a Uni emitting the value cached under
key, ordefaultValueif there is no cached value
-
getOrNull
public <K,V> io.smallrye.mutiny.Uni<V> getOrNull(K key) Description copied from interface:RedisCacheReturnsUnithat completes with a value present in the cache under the givenkey. If there is no value in the cache under the key, theUnicompletes withnull.- Specified by:
getOrNullin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the key- Returns:
- a Uni emitting the value cached under
key, ornullif there is no cached value
-
getOrNull
Description copied from interface:RedisCacheReturnsUnithat completes with a value present in the cache under the givenkey. If there is no value in the cache under the key, theUnicompletes withnull.- Specified by:
getOrNullin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keyclazz- the class of the value- Returns:
- a Uni emitting the value cached under
key, ornullif there is no cached value
-
getOrNull
public <K,V> io.smallrye.mutiny.Uni<V> getOrNull(K key, jakarta.enterprise.util.TypeLiteral<V> type) Description copied from interface:RedisCacheReturnsUnithat completes with a value present in the cache under the givenkey. If there is no value in the cache under the key, theUnicompletes withnull.- Specified by:
getOrNullin interfaceRedisCache- Type Parameters:
K- the type of keyV- the type of value- Parameters:
key- the keytype- the type of the value- Returns:
- a Uni emitting the value cached under
key, ornullif there is no cached value
-
invalidate
- Specified by:
invalidatein interfaceio.quarkus.cache.Cache
-
invalidateAll
- Specified by:
invalidateAllin interfaceio.quarkus.cache.Cache
-
invalidateIf
- Specified by:
invalidateIfin interfaceio.quarkus.cache.Cache
-
computeActualKey
-
computeUserKey
-