guyeuro
V2EX  ›  问与答

RedisTemplate 如何检查某个 key 是否存在?

  •  
  •   guyeuro · Aug 23, 2017 · 20823 views
    This topic created in 3368 days ago, the information mentioned may be changed or developed.
    13 replies  •  2017-08-24 15:31:03 +08:00
    zjp
    zjp
    Aug 23, 2017 via Android
    1
    get() 然后判断是否为 null 不行吗
    guyeuro
    guyeuro
    OP
    Aug 23, 2017
    2
    @zjp hash 和 set 的键呢
    guyeuro
    guyeuro
    OP
    Aug 23, 2017
    3
    @guyeuro get 有 nullpointexception 啊
    irockytan
    irockytan
    Aug 23, 2017 via iPhone
    4
    api 文档看看,有 exist 和 hexist 的
    guyeuro
    guyeuro
    OP
    Aug 23, 2017
    5
    @irockytan 没有啊,哪里的文档说有?
    KillThunder
    KillThunder
    Aug 23, 2017
    6
    EXISTS key
    检查给定 key 是否存在。
    guyeuro
    guyeuro
    OP
    Aug 23, 2017❤️1
    7
    @KillThunder 这是 redis 的命令,不是 redistemplate 里的啊
    251804746
    251804746
    Aug 23, 2017
    8
    valueOperations.getOperations().hasKey("");
    LaudOak
    LaudOak
    Aug 23, 2017
    9
    LaudOak
    LaudOak
    Aug 23, 2017
    10


    RedisTemplate#hasKey(K key)
    ooTwToo
    ooTwToo
    Aug 23, 2017 via Android
    11
    进去看看有哪些方法再来问。。
    GoGoGoBoy
    GoGoGoBoy
    Aug 23, 2017 via iPhone
    12
    @LaudOak 为什么设计成回掉模式???
    KillThunder
    KillThunder
    Aug 24, 2017
    13
    @guyeuro redistemplate 和 jedis 有什么区别吗?哪个比较好用?
    About   ·   Help   ·   Advertise   ·   Blog   ·   API   ·   FAQ   ·   Privacy   ·   Solana   ·   948 Online   Highest 6679   ·     Select Language
    创意工作者们的社区
    World is powered by solitude
    VERSION: 3.9.8.5 · 37ms · UTC 19:58 · PVG 03:58 · LAX 11:58 · JFK 14:58
    ♥ Do have faith in what you're doing.