类 RedisHashCache

java.lang.Object
net.oschina.j2cache.redis.RedisHashCache
所有已实现的接口:
Cache, Level2Cache

public class RedisHashCache extends Object implements Level2Cache
Redis 缓存操作封装,基于 Hashs 实现多个 Region 的缓存
作者:
wendal, Winter Lau(javayou@gmail.com) 重要提示!!! hash 存储模式无法单独对 key 设置 expire
  • 构造器详细资料

    • RedisHashCache

      public RedisHashCache(String namespace, String region, RedisClient client)
      缓存构造
      参数:
      namespace - 命名空间,用于在多个实例中避免 key 的重叠
      region - 缓存区域的名称
      client - 缓存客户端接口
  • 方法详细资料

    • getBytes

      public byte[] getBytes(String key)
      从接口复制的说明: Level2Cache
      读取缓存数据字节数组
      指定者:
      getBytes 在接口中 Level2Cache
      参数:
      key - cache key
      返回:
      cache data
    • getBytes

      public List<byte[]> getBytes(Collection<String> keys)
      从接口复制的说明: Level2Cache
      同时读取多个 Key
      指定者:
      getBytes 在接口中 Level2Cache
      参数:
      keys - multiple cache key
      返回:
      cache values
    • setBytes

      public void setBytes(String key, byte[] bytes)
      从接口复制的说明: Level2Cache
      设置缓存数据字节数组
      指定者:
      setBytes 在接口中 Level2Cache
      参数:
      key - cache key
      bytes - cache data
    • setBytes

      public void setBytes(Map<String,byte[]> bytes)
      从接口复制的说明: Level2Cache
      同时设置多个数据
      指定者:
      setBytes 在接口中 Level2Cache
      参数:
      bytes - cache data
    • exists

      public boolean exists(String key)
      从接口复制的说明: Level2Cache
      判断缓存数据是否存在
      指定者:
      exists 在接口中 Cache
      指定者:
      exists 在接口中 Level2Cache
      参数:
      key - cache key
      返回:
      true if cache key exists in redis
    • evict

      public void evict(String... keys)
      从接口复制的说明: Level2Cache
      Remove items from the cache
      指定者:
      evict 在接口中 Cache
      指定者:
      evict 在接口中 Level2Cache
      参数:
      keys - Cache key
    • keys

      public Collection<String> keys()
      从接口复制的说明: Level2Cache
      Return all keys
      指定者:
      keys 在接口中 Cache
      指定者:
      keys 在接口中 Level2Cache
      返回:
      返回键的集合
    • clear

      public void clear()
      从接口复制的说明: Level2Cache
      Clear the cache
      指定者:
      clear 在接口中 Cache
      指定者:
      clear 在接口中 Level2Cache