redisTemplate 操作 ListOperations

/**
     * 获取指定key的范围内的value值的 list列表。 (0  -1)反回所有值列表 
     *
     * @param key 不能为null
     * @param start 起始位置
     * @param end  结束位置
     * @return V的列表
     */
    List<V> range(K key, long start, long end);

    /**
     * 保留key指定范围内的列表值。其它的都删除。
     *
     * @param key 不能为null
     * @param start 起始位置
     * @param end  结束位置
     */
    void trim(K key, long start, long end);

    /**
     * 获取key 列表的长度
     *
     * @param key 不能为null
     * @return 列表长度
     */
    Long size(K key);

    /**
     * 从key列表左边(从头部)插入 值
     *
     * @param key 不能为空
     * @param value 插入列表的值
     * @return 返回列表插入后的长度
     */
    Long leftPush(K key, V value);

    /**
     * 从key列表左边(头部)插入多个值
     *
      * @param key 不能为空
     * @param value 插入列表的值
     * @return 返回列表插入后的长度
     */
    Long leftPushAll(K key, V... values);

/**
     * 从key列表左边(头部)依次插入集合中的值
     *
     * @param key 不能为空
     * @param value 插入列表的值
     * @return 返回列表插入后的长度
     */
    Long leftPushAll(K key, Collection<V> values);

    /**
     * 如果列表存在,则在列表左边插入值value
     *
      * @param key 不能为空
     * @param value 插入列表的值
     * @return 返回列表插入后的长度
     */
    Long leftPushIfPresent(K key, V value);

    /**
     * 在key的列表中指定的value左边(前面)插入一个新的value.
     *  如果 指定的value不存在则不插入任何值。
     *
     * @param key 不能为空
     * @param pivot 指定的value
     * @param value 插入的value
     * @return 返回列表的c行都
     */
    Long leftPush(K key, V pivot, V value);

    /**
     * 参照 leftPush(K key, V value)
     */
    Long rightPush(K key, V value);

    /**
     *  参照 Long leftPushAll(K key, V... values);
     */
    Long rightPushAll(K key, V... values);

    /**
     * 参照 Long rightPushAll(K key, Collection<V> values);
     */
    Long rightPushAll(K key, Collection<V> values);

    /**
    *参照     Long rightPushIfPresent(K key, V value);
     */
    Long rightPushIfPresent(K key, V value);

    /**
     * 参照 Long rightPush(K key, V pivot, V value);
     *
     */
    Long rightPush(K key, V pivot, V value);

    /**
     * 设置key列表中指定位置的值为value index不能大于列表长度。大于抛出异常
     * 为负数则从右边开始计算
     * @param key 不能为空
     * @param index
     * @param value
     */
    void set(K key, long index, V value);

    /**
     * 删除列表中第一个遇到的value值。count指定删除多少个。
     *
     * @param key 不能为null
     * @param count
     * @param value
     * @return 返回列表的长度
     */
    Long remove(K key, long count, Object value);

    /**
     * 获取列表中指定索引的value
     *
     * @param key 不能为null
     * @param index
     * @return
     * @see <a href="http://redis.io/commands/lindex">Redis Documentation: LINDEX</a>
     */
    V index(K key, long index);

    /**
     * 移除列表中的第一个值,并返回该值
     *
     * @param key 不能为null
     * @return 移除的值
     */
    V leftPop(K key);

    /**
     * 阻塞版本的 leftPop(K key) 移除列表的第一个值,并且返回。如果列表为空,
     * 则一直阻塞指定的时间单位
     *
     * @param key 不能为null
     * @param timeout 时间
     * @param unit 不能为空,时间单位
     * @return
     * @see <a href="http://redis.io/commands/blpop">Redis Documentation: BLPOP</a>
     */
    V leftPop(K key, long timeout, TimeUnit unit);

    /**
     * 参照 V leftPop(K key);
     */
    V rightPop(K key);

    /**
     * 参照  V leftPop(K key, long timeout, TimeUnit unit);
     */
    V rightPop(K key, long timeout, TimeUnit unit);

    /**
     * 从指定列表中从右边(尾部)移除第一个值,并将这个值从左边(头部)插入目标列表
     * 返回移除(插入)的值
     */
    V rightPopAndLeftPush(K sourceKey, K destinationKey);

    /**
     * 阻塞版本的   V rightPopAndLeftPush(K sourceKey, K destinationKey);
     * 如果移除的列表中没有值,则一直阻塞指定的单位时间
     */
    V rightPopAndLeftPush(K sourceKey, K destinationKey, long timeout, TimeUnit unit);
原文链接:https://blog.csdn.net/pengdandezhi/article/details/78903625
  • 0
    点赞
  • 0
    收藏
    觉得还不错? 一键收藏
  • 0
    评论

“相关推荐”对你有帮助么?

  • 非常没帮助
  • 没帮助
  • 一般
  • 有帮助
  • 非常有帮助
提交
评论
添加红包

请填写红包祝福语或标题

红包个数最小为10个

红包金额最低5元

当前余额3.43前往充值 >
需支付:10.00
成就一亿技术人!
领取后你会自动成为博主和红包主的粉丝 规则
hope_wisdom
发出的红包
实付
使用余额支付
点击重新获取
扫码支付
钱包余额 0

抵扣说明:

1.余额是钱包充值的虚拟货币,按照1:1的比例进行支付金额的抵扣。
2.余额无法直接购买下载,可以购买VIP、付费专栏及课程。

余额充值