【问题标题】:How to do set nx option using RedisTemplate?如何使用 RedisTemplate 设置 nx 选项?
【发布时间】:2017-07-03 01:23:12
【问题描述】:

我正在尝试使用 Spring Data Redis API,并希望使用 nx 选项执行一个集合。但是,我在 RedisTemplate 中没有找到相关的方法。我该怎么做?

【问题讨论】:

    标签: redis spring-data-redis


    【解决方案1】:

    【讨论】:

    • 如果我想同时添加过期时间怎么办? setIfAbsent 不提供过期时间的参数。
    • setIfAbsent support set expires since 2.1 version
    猜你喜欢
    • 2023-02-05
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2013-01-29
    • 2011-10-06
    • 1970-01-01
    • 2010-10-26
    • 2019-12-23
    相关资源
    最近更新 更多