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

    Modifier and Type
    Method
    Description
    (package private) String
     
    (package private) Object
     
    <K, V> io.smallrye.mutiny.Uni<V>
    get(K key, jakarta.enterprise.util.TypeLiteral<V> type, Function<K,V> valueLoader)
    Allows retrieving a value from the Redis cache.
    <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>
    get(K key, Function<K,V> valueLoader)
     
    <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>
    getAsync(K key, Class<V> clazz, Function<K,io.smallrye.mutiny.Uni<V>> valueLoader)
    Allows retrieving a value from the Redis cache.
    <K, V> io.smallrye.mutiny.Uni<V>
    getAsync(K key, Function<K,io.smallrye.mutiny.Uni<V>> valueLoader)
     
     
    When configured, gets the default type of the value stored in the cache.
     
    <K, V> io.smallrye.mutiny.Uni<V>
    getOrDefault(K key, jakarta.enterprise.util.TypeLiteral<V> type, V defaultValue)
    Returns Uni that completes with a value present in the cache under the given key.
    <K, V> io.smallrye.mutiny.Uni<V>
    getOrDefault(K key, Class<V> clazz, V defaultValue)
    Returns Uni that completes with a value present in the cache under the given key.
    <K, V> io.smallrye.mutiny.Uni<V>
    getOrDefault(K key, V defaultValue)
    Returns Uni that completes with a value present in the cache under the given key.
    <K, V> io.smallrye.mutiny.Uni<V>
    getOrNull(K key)
    Returns Uni that completes with a value present in the cache under the given key.
    <K, V> io.smallrye.mutiny.Uni<V>
    getOrNull(K key, jakarta.enterprise.util.TypeLiteral<V> type)
    Returns Uni that completes with a value present in the cache under the given key.
    <K, V> io.smallrye.mutiny.Uni<V>
    getOrNull(K key, Class<V> clazz)
    Returns Uni that completes with a value present in the cache under the given key.
    io.smallrye.mutiny.Uni<Void>
     
    io.smallrye.mutiny.Uni<Void>
     
    io.smallrye.mutiny.Uni<Void>
     
    <K, V> io.smallrye.mutiny.Uni<Void>
    put(K key, Supplier<V> supplier)
    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

    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.Cache

    as
  • Constructor Details

    • 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 Details

    • getName

      public String getName()
      Specified by:
      getName in interface Cache
    • getDefaultKey

      public Object getDefaultKey()
      Specified by:
      getDefaultKey in interface Cache
      Overrides:
      getDefaultKey in class AbstractCache
    • getDefaultValueType

      public Class<?> getDefaultValueType()
      Description copied from interface: RedisCache
      When configured, gets the default type of the value stored in the cache. The configured type is used in methods RedisCache.get(Object, Function), RedisCache.getAsync(Object, Function), RedisCache.getOrDefault(Object, Object) and RedisCache.getOrNull(Object).
      Specified by:
      getDefaultValueType in interface RedisCache
      Returns:
      the type, null if not configured or if not a Class.
    • get

      public <K, V> io.smallrye.mutiny.Uni<V> get(K key, Function<K,V> valueLoader)
      Specified by:
      get in interface Cache
      Specified by:
      get in interface RedisCache
    • get

      public <K, V> io.smallrye.mutiny.Uni<V> get(K key, Class<V> clazz, Function<K,V> valueLoader)
      Description copied from interface: RedisCache
      Allows retrieving a value from the Redis cache.
      Specified by:
      get in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      clazz - the class of the value
      valueLoader - 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: RedisCache
      Allows retrieving a value from the Redis cache.
      Specified by:
      get in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      type - the type of the value
      valueLoader - 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:
      getAsync in interface Cache
      Specified by:
      getAsync in interface RedisCache
    • 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: RedisCache
      Allows retrieving a value from the Redis cache.
      Specified by:
      getAsync in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      clazz - the class of the value
      valueLoader - 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: RedisCache
      Allows retrieving a value from the Redis cache.
      Specified by:
      getAsync in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      type - the type of the value
      valueLoader - 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: RedisCache
      Put a value in the cache.
      Specified by:
      put in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      value - the value
      Returns:
      a Uni emitting null when the operation completes
    • put

      public <K, V> io.smallrye.mutiny.Uni<Void> put(K key, Supplier<V> supplier)
      Description copied from interface: RedisCache
      Put a value in the cache.
      Specified by:
      put in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      supplier - supplier of the value
      Returns:
      a Uni emitting null when the operation completes
    • getOrDefault

      public <K, V> io.smallrye.mutiny.Uni<V> getOrDefault(K key, V defaultValue)
      Description copied from interface: RedisCache
      Returns Uni that completes with a value present in the cache under the given key. If there is no value in the cache under the key, the Uni completes with the given defaultValue.
      Specified by:
      getOrDefault in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      defaultValue - the default value
      Returns:
      a Uni emitting the value cached under key, or defaultValue if there is no cached value
    • getOrDefault

      public <K, V> io.smallrye.mutiny.Uni<V> getOrDefault(K key, Class<V> clazz, V defaultValue)
      Description copied from interface: RedisCache
      Returns Uni that completes with a value present in the cache under the given key. If there is no value in the cache under the key, the Uni completes with the given defaultValue.
      Specified by:
      getOrDefault in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      clazz - class of the value
      defaultValue - the default value
      Returns:
      a Uni emitting the value cached under key, or defaultValue if 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: RedisCache
      Returns Uni that completes with a value present in the cache under the given key. If there is no value in the cache under the key, the Uni completes with the given defaultValue.
      Specified by:
      getOrDefault in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      type - type of the value
      defaultValue - the default value
      Returns:
      a Uni emitting the value cached under key, or defaultValue if there is no cached value
    • getOrNull

      public <K, V> io.smallrye.mutiny.Uni<V> getOrNull(K key)
      Description copied from interface: RedisCache
      Returns Uni that completes with a value present in the cache under the given key. If there is no value in the cache under the key, the Uni completes with null.
      Specified by:
      getOrNull in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      Returns:
      a Uni emitting the value cached under key, or null if there is no cached value
    • getOrNull

      public <K, V> io.smallrye.mutiny.Uni<V> getOrNull(K key, Class<V> clazz)
      Description copied from interface: RedisCache
      Returns Uni that completes with a value present in the cache under the given key. If there is no value in the cache under the key, the Uni completes with null.
      Specified by:
      getOrNull in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      clazz - the class of the value
      Returns:
      a Uni emitting the value cached under key, or null if 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: RedisCache
      Returns Uni that completes with a value present in the cache under the given key. If there is no value in the cache under the key, the Uni completes with null.
      Specified by:
      getOrNull in interface RedisCache
      Type Parameters:
      K - the type of key
      V - the type of value
      Parameters:
      key - the key
      type - the type of the value
      Returns:
      a Uni emitting the value cached under key, or null if there is no cached value
    • invalidate

      public io.smallrye.mutiny.Uni<Void> invalidate(Object key)
      Specified by:
      invalidate in interface Cache
    • invalidateAll

      public io.smallrye.mutiny.Uni<Void> invalidateAll()
      Specified by:
      invalidateAll in interface Cache
    • invalidateIf

      public io.smallrye.mutiny.Uni<Void> invalidateIf(Predicate<Object> predicate)
      Specified by:
      invalidateIf in interface Cache
    • computeActualKey

      String computeActualKey(String key)
    • computeUserKey

      Object computeUserKey(String key)