接口 Level2Cache

所有超级接口:
Cache
所有已知实现类:
LettuceCache, LettuceGenericCache, LettuceHashCache, MemCache, NullCache, RedisGenericCache, RedisHashCache

public interface Level2Cache extends Cache
二级缓存接口
作者:
Winter Lau(javayou@gmail.com)
  • 字段概要

    字段
    修饰符和类型
    字段
    说明
    static final org.slf4j.Logger
     
  • 方法概要

    修饰符和类型
    方法
    说明
    void
    Clear the cache
    void
    evict(String... keys)
    Remove items from the cache
    default boolean
    判断缓存数据是否存在
    default Object
    get(String key)
    Get an item from the cache, nontransactionally
    default Map<String,Object>
    批量获取缓存对象
    byte[]
    读取缓存数据字节数组
    List<byte[]>
    同时读取多个 Key
    Return all keys
    default void
    put(String key, Object value)
    Add an item to the cache, nontransactionally, with failfast semantics
    default void
    put(String key, Object value, long timeToLiveInSeconds)
    设置缓存数据的有效期
    default void
    put(Map<String,Object> elements)
    批量插入数据
    default void
    put(Map<String,Object> elements, long timeToLiveInSeconds)
     
    void
    setBytes(String key, byte[] bytes)
    设置缓存数据字节数组
    default void
    setBytes(String key, byte[] bytes, long timeToLiveInSeconds)
    设置缓存数据字节数组(带有效期)
    void
    setBytes(Map<String,byte[]> bytes)
    同时设置多个数据
    default void
    setBytes(Map<String,byte[]> bytes, long timeToLiveInSeconds)
    批量设置带 TTL 的缓存数据
    default boolean
    是否支持缓存 TTL 的设置
  • 字段详细资料

    • log

      static final org.slf4j.Logger log
  • 方法详细资料

    • supportTTL

      default boolean supportTTL()
      是否支持缓存 TTL 的设置
      返回:
      true/false if cache support ttl setting
    • getBytes

      byte[] getBytes(String key)
      读取缓存数据字节数组
      参数:
      key - cache key
      返回:
      cache data
    • getBytes

      List<byte[]> getBytes(Collection<String> keys)
      同时读取多个 Key
      参数:
      keys - multiple cache key
      返回:
      cache values
    • setBytes

      void setBytes(String key, byte[] bytes)
      设置缓存数据字节数组
      参数:
      key - cache key
      bytes - cache data
    • setBytes

      void setBytes(Map<String,byte[]> bytes)
      同时设置多个数据
      参数:
      bytes - cache data
    • setBytes

      default void setBytes(String key, byte[] bytes, long timeToLiveInSeconds)
      设置缓存数据字节数组(带有效期)
      参数:
      key - cache key
      bytes - cache data
      timeToLiveInSeconds - cache ttl
    • setBytes

      default void setBytes(Map<String,byte[]> bytes, long timeToLiveInSeconds)
      批量设置带 TTL 的缓存数据
      参数:
      bytes - cache data
      timeToLiveInSeconds - cache ttl
    • exists

      default boolean exists(String key)
      判断缓存数据是否存在
      指定者:
      exists 在接口中 Cache
      参数:
      key - cache key
      返回:
      true if cache key exists in redis
    • keys

      Return all keys
      指定者:
      keys 在接口中 Cache
      返回:
      返回键的集合
    • evict

      void evict(String... keys)
      Remove items from the cache
      指定者:
      evict 在接口中 Cache
      参数:
      keys - Cache key
    • clear

      void clear()
      Clear the cache
      指定者:
      clear 在接口中 Cache
    • get

      default Object get(String key)
      从接口复制的说明: Cache
      Get an item from the cache, nontransactionally
      指定者:
      get 在接口中 Cache
      参数:
      key - cache key
      返回:
      the cached object or null
    • get

      default Map<String,Object> get(Collection<String> keys)
      从接口复制的说明: Cache
      批量获取缓存对象
      指定者:
      get 在接口中 Cache
      参数:
      keys - cache keys
      返回:
      return key-value objects
    • put

      default void put(String key, Object value)
      从接口复制的说明: Cache
      Add an item to the cache, nontransactionally, with failfast semantics
      指定者:
      put 在接口中 Cache
      参数:
      key - cache key
      value - cache value
    • put

      default void put(String key, Object value, long timeToLiveInSeconds)
      设置缓存数据的有效期
      参数:
      key - cache key
      value - cache value
      timeToLiveInSeconds - cache ttl
    • put

      default void put(Map<String,Object> elements)
      从接口复制的说明: Cache
      批量插入数据
      指定者:
      put 在接口中 Cache
      参数:
      elements - objects to be put in cache
    • put

      default void put(Map<String,Object> elements, long timeToLiveInSeconds)