Redis store key without a value

后端 未结 4 1881
时光取名叫无心
时光取名叫无心 2021-02-06 22:31

When using the Redis expire commands like SETEX and TTL, there are scenarios in which there is no need for the key to hold a v

4条回答
  •  说谎
    说谎 (楼主)
    2021-02-06 22:40

    I would avoid using "". How about simple 0 ?

    127.0.0.1:6379> set akey 0
    OK
    127.0.0.1:6379> memory usage akey
    (integer) 48
    127.0.0.1:6379> set akey ""
    OK
    127.0.0.1:6379> memory usage akey
    (integer) 50
    127.0.0.1:6379>
    

提交回复
热议问题