类 RedisCacheHelper


  • public final class RedisCacheHelper
    extends Object
    redis缓存助手
    作者:
    qiushui on 2020-04-30.
    • 方法概要

      所有方法 静态方法 具体方法 
      修饰符和类型 方法 说明
      static <K,​V>
      void
      deleteKeys​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K pattern)
      批量删除
      static <K,​V>
      boolean
      hasKey​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key)
      判断是否有键
      static <K,​V>
      boolean
      listEmpty​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key)
      列表是否为空
      static <K,​V>
      develop.toolkit.base.struct.KeyValuePair<Long,​V>
      listFind​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key, Predicate<V> predicate)
      列表匹配查询匹配单个
      static <K,​V>
      develop.toolkit.base.struct.KeyValuePairs<Long,​V>
      listFindAll​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key, Predicate<V> predicate)
      列表匹配查询
      static <K,​V>
      boolean
      listNotEmpty​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key)
      列表是否有值
      static <K,​V>
      long
      listSize​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key)
      获取列表长度
      static <H,​HK,​HV>
      HV
      readHash​(org.springframework.data.redis.core.RedisTemplate<H,​HV> redisTemplate, H key, HK hashKey, Supplier<HV> defaultSupplier)
      读取Hash值
      static <K,​V>
      V
      readValue​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate, K key, Duration timeout, Supplier<V> defaultSupplier)
      读取值
    • 构造器详细资料

      • RedisCacheHelper

        public RedisCacheHelper()
    • 方法详细资料

      • hasKey

        public static <K,​V> boolean hasKey​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                 K key)
        判断是否有键
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        key -
        返回:
      • listSize

        public static <K,​V> long listSize​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                K key)
        获取列表长度
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        key -
        返回:
      • listNotEmpty

        public static <K,​V> boolean listNotEmpty​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                       K key)
        列表是否有值
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        key -
        返回:
      • listEmpty

        public static <K,​V> boolean listEmpty​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                    K key)
        列表是否为空
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        key -
        返回:
      • listFind

        public static <K,​V> develop.toolkit.base.struct.KeyValuePair<Long,​V> listFind​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                                                                  K key,
                                                                                                  Predicate<V> predicate)
        列表匹配查询匹配单个
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        key -
        predicate -
        返回:
      • listFindAll

        public static <K,​V> develop.toolkit.base.struct.KeyValuePairs<Long,​V> listFindAll​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                                                                      K key,
                                                                                                      Predicate<V> predicate)
        列表匹配查询
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        key -
        predicate -
        返回:
      • readValue

        public static <K,​V> V readValue​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                              K key,
                                              Duration timeout,
                                              Supplier<V> defaultSupplier)
        读取值
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        defaultSupplier -
        key -
        返回:
      • readHash

        public static <H,​HK,​HV> HV readHash​(org.springframework.data.redis.core.RedisTemplate<H,​HV> redisTemplate,
                                                        H key,
                                                        HK hashKey,
                                                        Supplier<HV> defaultSupplier)
        读取Hash值
        类型参数:
        H -
        HK -
        HV -
        参数:
        redisTemplate -
        key -
        hashKey -
        defaultSupplier -
        返回:
      • deleteKeys

        public static <K,​V> void deleteKeys​(org.springframework.data.redis.core.RedisTemplate<K,​V> redisTemplate,
                                                  K pattern)
        批量删除
        类型参数:
        K -
        V -
        参数:
        redisTemplate -
        pattern -