Interface CacheKeyPrefix

Functional Interface:
This is a functional interface and can therefore be used as the assignment target for a lambda expression or method reference.

@FunctionalInterface public interface CacheKeyPrefix
CacheKeyPrefix is a callback hook for creating custom prefixes prepended to the actual key stored in Redis.
Since:
2.0.4
Author:
Christoph Strobl, Mark Paluch, John Blum
  • Field Details

  • Method Details

    • compute

      String compute(String cacheName)
      Compute the prefix for the actual cache key stored in Redis.
      Parameters:
      cacheName - name of the cache in which the key is stored; will never be null.
      Returns:
      the computed prefix of the cache key stored in Redis; never null.
    • simple

      static CacheKeyPrefix simple()
      Creates a default CacheKeyPrefix scheme that prefixes cache keys with the name of the cache followed by double colons. For example, a cache named myCache will prefix all cache keys with myCache::.
      Returns:
      the default CacheKeyPrefix scheme.
    • prefixed

      static CacheKeyPrefix prefixed(String prefix)
      Creates a CacheKeyPrefix scheme that prefixes cache keys with the given prefix. The prefix is prepended to the cacheName followed by double colons. For example, a prefix redis- with a cache named myCache results in redis-myCache::.
      Parameters:
      prefix - must not be null.
      Returns:
      the default CacheKeyPrefix scheme.
      Since:
      2.3