LoginSignup
0
0

More than 5 years have passed since last update.

Redisのlpushとexpireの確認

Posted at

redis 2.1.3より前のバージョンではlpushにexpireを付けていると、lpushした時点で削除されていたようですが、現行のバージョンでは削除されないのでその動作確認メモ。
expireで3秒をセットした後、lpushしてもデータは削除されず、3秒に有効期限切れで削除されている。

[vagrant@localhost ~]$ redis-cli lpush mylist hello hoge
(integer) 2
[vagrant@localhost ~]$ redis-cli expire mylist 3
(integer) 1
[vagrant@localhost ~]$ redis-cli lpush mylist hello hoge
(integer) 4
[vagrant@localhost ~]$ redis-cli lpush mylist hello hoge
(integer) 6
[vagrant@localhost ~]$ redis-cli lpush mylist hello hoge
(integer) 8
[vagrant@localhost ~]$ redis-cli lpush mylist hello hoge
(integer) 10
[vagrant@localhost ~]$ redis-cli lpush mylist hello hoge
(integer) 2
0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0