接口 IRedisDao<K,​V>

  • 所有已知实现类:
    RedisDaoImpl

    public interface IRedisDao<K,​V>
    作者:
    ths
    • 方法概要

      所有方法 实例方法 抽象方法 
      修饰符和类型 方法 说明
      int count​(K pattern)
      根据key获取个数(key值可为模糊匹配 a:b:* | *代表任意字符)
      long delete​(Set<K> keys)
      批量删除对应的value
      boolean delete​(K key)
      根据key删除对应的value
      void delete​(K[] keys)
      批量删除对应的value
      long deletePattern​(K pattern)
      批量删除key(key值可为模糊匹配 a:b:* | *代表任意字符)
      boolean existsKey​(K key)
      判断缓存中是否有对应的value
      <T> T get​(K key, Class<T> clazz)
      读取缓存(操作字符串)
      int getSize()
      获取 db 数量
      long hDel​(K key, K... hashKey)
      哈希删除数据(操作hash)
      Map<K,​V> hGet​(K key)
      哈希获取数据(操作hash)
      <T> T hGet​(K key, K hashKey, Class<T> clazz)
      哈希获取数据(操作hash)
      void hIncr​(K key, K hashKey, Long value)
      将hashKey中储存的数字加上指定的增量值(操作hash)
      void hSet​(K key, K hashKey, V value)
      哈希 添加(操作hash)
      void hSetAll​(K key, Map<K,​V> map)
      哈希 添加(操作hash)
      long hSize​(K key)
      获取key所对应的散列表的大小个数(操作hash)
      List<V> hValues​(K key)
      获取key获取哈希表所有value
      boolean incr​(K key, Long value)
      将key中储存的数字加上指定的增量值(操作字符串)
      Set<K> keys​(K pattern)
      根据key获取key列表(key值可为模糊匹配 a:b:* | *代表任意字符)
      V lIndex​(K key, long index)
      通过其索引从列表获取元素(操作list)
      V lIndexFirst​(K key)
      通过其索引从列表获取第一个元素(操作list)
      V lLeftPop​(K key)
      删除并获取列表中的第1个元素(操作list)
      boolean lLeftPush​(K key, V value)
      从左向右添加列表(操作list)
      boolean lLeftPush​(K key, V value, boolean bool)
      从左向右添加列表(操作list);如果bool=true,会删除列表中已经存在的数据,然后再进行添加(仅针对字符串列表,其它待测)
      long lLeftPushAll​(K key, List<V> lst)
      从左向右添加列表(操作list)
      List<V> lRange​(K key)
      根据key获取获取List列表(操作list)
      List<V> lRange​(K key, long start, long end)
      根据key获取列表中第start至end的数据(操作list)
      long lRemove​(K key, long count)
      移除k中的count个,返回删除的个数;如果没有这个元素则返回0(操作list)
      long lRemove​(K key, long count, V value)
      移除k中值为v的count个,返回删除的个数;如果没有这个元素则返回0(操作list)
      long lRemove​(K key, V value)
      移除k中值为v的所有数据,返回删除的个数;如果没有这个元素则返回0(操作list)
      V lRightPop​(K key)
      删除并获取列表中的最后1个元素(操作list)
      boolean lRightPush​(K key, V value)
      从右向左添加列表(操作list)
      boolean lRightPush​(K key, V value, boolean bool)
      从右向左添加列表(操作list);如果bool=true,会删除列表中已经存在的数据,然后再进行添加(仅针对字符串列表,其它待测)
      long lRightPushAll​(K key, List<V> lst)
      从右向左添加列表(操作list)
      long lSize​(K key)
      获取列表中个数
      void renameKey​(K oldKey, K newKey)
      重命名 key name
      long sAdd​(K key, V... value)
      集合添加
      Set<V> sDifference​(K key, K otherKey)
      key无序集合与otherKey无序集合的差集
      Set<V> sDistinctRandomMembers​(K key, long count)
      获取多个key无序集合中的元素(去重),count表示个数
      boolean set​(K key, V value)
      写入缓存(操作字符串)
      boolean set​(K key, V value, Long expireTime)
      写入缓存设置时效时间(操作字符串)
      boolean set​(K key, V value, Long expireTime, TimeUnit unit)
      写入缓存设置时效时间(操作字符串)
      boolean sIsMember​(K key, V value)
      集合是否存在value值
      Set<V> sMembers​(K key)
      获取集合
      V sPop​(K key)
      移除并返回集合中的一个随机元素
      V sRandomMember​(K key)
      返回集合中的一个随机元素(不删除)
      List<V> sRandomMembers​(K key, long count)
      获取多个key无序集合中的元素,count表示个数
      long sRemove​(K key, V... values)
      删除集合中的指定元素
      long sSize​(K key)
      获取集合长度
      org.springframework.data.redis.connection.DataType type​(K key)
      返回key所储存的值的类型
      boolean updateExpireTime​(K key, Long expireTime)
      更新写入缓存设置时效时间(操作字符串)
      long zAdd​(K key, Set<org.springframework.data.redis.core.ZSetOperations.TypedTuple<V>> tuples)
      有序集合添加
      boolean zAdd​(K key, V value, double score)
      有序集合添加
      Set<V> zRangeByScore​(K key, double lowScore, double highScore)
      根据键和权重范围获取有序集合
      long zRemove​(K key, V... values)
      有序集合删除
    • 方法详细资料

      • getSize

        int getSize()
        获取 db 数量
        返回:
        db 数量
      • type

        org.springframework.data.redis.connection.DataType type​(K key)
        返回key所储存的值的类型
        参数:
        key - 键 键
        返回:
        DataType[NONE(" none "), STRING("string"), LIST("list"), SET("set"), ZSET("zset"), HASH("hash");]
      • existsKey

        boolean existsKey​(K key)
        判断缓存中是否有对应的value
        参数:
        key - 键
        返回:
        boolean
      • renameKey

        void renameKey​(K oldKey,
                       K newKey)
        重命名 key name
        参数:
        oldKey - 原有key名
        newKey - 新key名
      • keys

        Set<K> keys​(K pattern)
        根据key获取key列表(key值可为模糊匹配 a:b:* | *代表任意字符)
        参数:
        pattern - 表达式
        返回:
        键集合
      • count

        int count​(K pattern)
        根据key获取个数(key值可为模糊匹配 a:b:* | *代表任意字符)
        参数:
        pattern - 键
        返回:
        int
      • delete

        boolean delete​(K key)
        根据key删除对应的value
        参数:
        key - 键
        返回:
        boolean
      • delete

        void delete​(K[] keys)
        批量删除对应的value
        参数:
        keys - 键集合
      • deletePattern

        long deletePattern​(K pattern)
        批量删除key(key值可为模糊匹配 a:b:* | *代表任意字符)
        参数:
        pattern - 表达式
        返回:
        boolean
      • delete

        long delete​(Set<K> keys)
        批量删除对应的value
        参数:
        keys - 键集合
        返回:
        boolean
      • set

        boolean set​(K key,
                    V value)
        写入缓存(操作字符串)
        参数:
        key - 键
        value - 值
        返回:
        boolean
      • incr

        boolean incr​(K key,
                     Long value)
        将key中储存的数字加上指定的增量值(操作字符串)
        参数:
        key - 键
        value - 值
        返回:
        boolean
      • set

        boolean set​(K key,
                    V value,
                    Long expireTime,
                    TimeUnit unit)
        写入缓存设置时效时间(操作字符串)
        参数:
        key - 键
        value - 值
        expireTime - 过期时间(秒)
        unit - 时间单位
        返回:
        boolean
      • set

        boolean set​(K key,
                    V value,
                    Long expireTime)
        写入缓存设置时效时间(操作字符串)
        参数:
        key - 键
        value - 值
        expireTime - 过期时间(秒)
        返回:
        boolean
      • updateExpireTime

        boolean updateExpireTime​(K key,
                                 Long expireTime)
        更新写入缓存设置时效时间(操作字符串)
        参数:
        key - 键
        expireTime - 过期时间(秒)
        返回:
        boolean
      • get

        <T> T get​(K key,
                  Class<T> clazz)
        读取缓存(操作字符串)
        类型参数:
        T - 返回类泛型
        参数:
        key - 键
        clazz - 转化类型
        返回:
        对象
      • hSet

        void hSet​(K key,
                  K hashKey,
                  V value)
        哈希 添加(操作hash)
        参数:
        key - 键
        hashKey - 哈希中的键
        value - 哈希中的值
      • hIncr

        void hIncr​(K key,
                   K hashKey,
                   Long value)
        将hashKey中储存的数字加上指定的增量值(操作hash)
        参数:
        key - 键
        hashKey - 哈希中的键
        value - 哈希中的值
      • hSetAll

        void hSetAll​(K key,
                     Map<K,​V> map)
        哈希 添加(操作hash)
        参数:
        key - 键
        map - 集合
      • hGet

        Map<K,​V> hGet​(K key)
        哈希获取数据(操作hash)
        参数:
        key - 键
        返回:
        Map
      • hGet

        <T> T hGet​(K key,
                   K hashKey,
                   Class<T> clazz)
        哈希获取数据(操作hash)
        类型参数:
        T - 返回类泛型
        参数:
        key - 键
        hashKey - 哈希中的键
        clazz - 类型转化
        返回:
        哈希中的值
      • hDel

        long hDel​(K key,
                  K... hashKey)
        哈希删除数据(操作hash)
        参数:
        key - 键
        hashKey - 哈希中的键
        返回:
        删除数量
      • hSize

        long hSize​(K key)
        获取key所对应的散列表的大小个数(操作hash)
        参数:
        key - 键
        返回:
        数量
      • hValues

        List<V> hValues​(K key)
        获取key获取哈希表所有value
        参数:
        key - 键
        返回:
        集合
      • lSize

        long lSize​(K key)
        获取列表中个数
        参数:
        key - 键
        返回:
        long
      • lIndexFirst

        V lIndexFirst​(K key)
        通过其索引从列表获取第一个元素(操作list)
        参数:
        key - 键
        返回:
        V
      • lIndex

        V lIndex​(K key,
                 long index)
        通过其索引从列表获取元素(操作list)
        参数:
        key - 键
        index - :索引位置,从0开始
        返回:
        V
      • lLeftPush

        boolean lLeftPush​(K key,
                          V value)
        从左向右添加列表(操作list)
        参数:
        key - 键
        value - 值
        返回:
        boolean
      • lLeftPush

        boolean lLeftPush​(K key,
                          V value,
                          boolean bool)
        从左向右添加列表(操作list);如果bool=true,会删除列表中已经存在的数据,然后再进行添加(仅针对字符串列表,其它待测)
        参数:
        key - 键
        value - 值
        bool - 如果bool=true,会删除列表中已经存在的数据
        返回:
        boolean
      • lLeftPushAll

        long lLeftPushAll​(K key,
                          List<V> lst)
        从左向右添加列表(操作list)
        参数:
        key - 键
        lst - 集合
        返回:
        数量
      • lRightPush

        boolean lRightPush​(K key,
                           V value)
        从右向左添加列表(操作list)
        参数:
        key - 键
        value - 值
        返回:
        boolean
      • lRightPush

        boolean lRightPush​(K key,
                           V value,
                           boolean bool)
        从右向左添加列表(操作list);如果bool=true,会删除列表中已经存在的数据,然后再进行添加(仅针对字符串列表,其它待测)
        参数:
        key - 键
        value - 值
        bool - 如果bool=true,会删除列表中已经存在的数据
        返回:
        boolean
      • lRightPushAll

        long lRightPushAll​(K key,
                           List<V> lst)
        从右向左添加列表(操作list)
        参数:
        key - 键
        lst - 集合
        返回:
        数量
      • lLeftPop

        V lLeftPop​(K key)
        删除并获取列表中的第1个元素(操作list)
        参数:
        key - 键
        返回:
        V
      • lRightPop

        V lRightPop​(K key)
        删除并获取列表中的最后1个元素(操作list)
        参数:
        key - 键
        返回:
        V
      • lRemove

        long lRemove​(K key,
                     long count)
        移除k中的count个,返回删除的个数;如果没有这个元素则返回0(操作list)
        参数:
        key - 键
        count - 数量
        返回:
        删除的数量
      • lRemove

        long lRemove​(K key,
                     long count,
                     V value)
        移除k中值为v的count个,返回删除的个数;如果没有这个元素则返回0(操作list)
        参数:
        key - 键
        count - 数量
        value - 值
        返回:
        删除的数量
      • lRemove

        long lRemove​(K key,
                     V value)
        移除k中值为v的所有数据,返回删除的个数;如果没有这个元素则返回0(操作list)
        参数:
        key - 键
        value - 值
        返回:
        删除的数量
      • lRange

        List<V> lRange​(K key)
        根据key获取获取List列表(操作list)
        参数:
        key - 键
        返回:
        集合
      • lRange

        List<V> lRange​(K key,
                       long start,
                       long end)
        根据key获取列表中第start至end的数据(操作list)
        参数:
        key - 键
        start - 开始位置
        end - 结束位置
        返回:
        集合
      • sAdd

        long sAdd​(K key,
                  V... value)
        集合添加
        参数:
        key - 键
        value - 值
        返回:
        添加的数量
      • sRandomMember

        V sRandomMember​(K key)
        返回集合中的一个随机元素(不删除)
        参数:
        key - 键
        返回:
        V
      • sRandomMembers

        List<V> sRandomMembers​(K key,
                               long count)
        获取多个key无序集合中的元素,count表示个数
        参数:
        key - 键
        count - 数量
        返回:
        集合
      • sDistinctRandomMembers

        Set<V> sDistinctRandomMembers​(K key,
                                      long count)
        获取多个key无序集合中的元素(去重),count表示个数
        参数:
        key - 键
        count - 数量
        返回:
        V
      • sPop

        V sPop​(K key)
        移除并返回集合中的一个随机元素
        参数:
        key - 键
        返回:
        V
      • sRemove

        long sRemove​(K key,
                     V... values)
        删除集合中的指定元素
        参数:
        key - 键
        values - 元素集
        返回:
        删除个数
      • sMembers

        Set<V> sMembers​(K key)
        获取集合
        参数:
        key - 键
        返回:
        集合
      • sIsMember

        boolean sIsMember​(K key,
                          V value)
        集合是否存在value值
        参数:
        key - 键
        value - 值
        返回:
        boolean
      • sSize

        long sSize​(K key)
        获取集合长度
        参数:
        key - 键
        返回:
        long
      • sDifference

        Set<V> sDifference​(K key,
                           K otherKey)
        key无序集合与otherKey无序集合的差集
        参数:
        key - 键
        otherKey - 另外的键
        返回:
        集合
      • zAdd

        boolean zAdd​(K key,
                     V value,
                     double score)
        有序集合添加
        参数:
        key - 键
        value - 值
        score - 权重、优先级
        返回:
        boolean
      • zAdd

        long zAdd​(K key,
                  Set<org.springframework.data.redis.core.ZSetOperations.TypedTuple<V>> tuples)
        有序集合添加
        参数:
        key - 键
        tuples - 有序集合
        返回:
        添加数量
      • zRemove

        long zRemove​(K key,
                     V... values)
        有序集合删除
        参数:
        key - 键
        values - 值
        返回:
        删除数量
      • zRangeByScore

        Set<V> zRangeByScore​(K key,
                             double lowScore,
                             double highScore)
        根据键和权重范围获取有序集合
        参数:
        key - 键
        lowScore - 低权重、优先级
        highScore - 高权重、优先级
        返回:
        集合