Skip to content

Instantly share code, notes, and snippets.

@huangzworks
Created April 13, 2014 01:21
Show Gist options
  • Save huangzworks/10564625 to your computer and use it in GitHub Desktop.
Save huangzworks/10564625 to your computer and use it in GitHub Desktop.
在复制模式下,如果主服务器不向从服务器显式地发送 DEL 命令以删除过期键,那么这个过期键会一直滞留在从服务器里面,尽管它已经过期了。
127.0.0.1:12345> TTL key # 尚未过期
(integer) 3
127.0.0.1:12345> TTL key
(integer) 1
127.0.0.1:12345> TTL key # 虽然键已经过期,但因为我阻塞住了主服务器,
(integer) 0 # 而主服务器没办法向从服务器发送 DEL 命令,所以值会一直滞留在从服务器里面。
127.0.0.1:12345> GET key
"value"
127.0.0.1:12345> TTL key
(integer) 0
127.0.0.1:12345> GET key
"value"
127.0.0.1:12345> TTL key
(integer) 0
127.0.0.1:12345> GET key
"value"
@git-hulk
Copy link

赞个!

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment