REDIS DELETE不会删除密钥
在我的redis数据库中,我有一个钥匙:
127.0.0.1:6379[5]> get "263384DB-61DD561800016316-240C0700"
"{\"json\":{\"created\":\"1641895448090335\",\"last_signal\":\"1641895448\",\"tos\":\"184\",\"deleted\":\"0\",\"num_sfds\":\"4\",\"num_streams\":\"4\",\"num_medias\":\"2\",\"num_tags\":\"2\",\"num_maps\":\"2\",\"ml_deleted\":\"0\",\"created_from\":
... about 6300 chars
我尝试了
127.0.0.1:6379[5]> del "263384DB-61DD561800016316-240C0700"
(integer) 1
我也尝试了:
127.0.0.1:6379[5]> DEL `"263384DB-61DD561800016316-240C0700"`
Invalid argument(s)
127.0.0.1:6379[5]> DEL '"263384DB-61DD561800016316-240C0700"'
(integer) 0
但是价值仍然存在:
127.0.0.1:6379[5]> get "263384DB-61DD561800016316-240C0700"
"{\"json\":{\"created\":\"1641895448090335\",\"last_signal\":\"1641895448\",\"tos\":\"184\",\"deleted\":\"0\",\"num_sfds\":\"4\",\"num_streams\":\"4\",\"num_medias\":\"2\",\"num_tags\":\"2\",\"num_maps\":\"2\",\"ml_deleted\":\"0\",\"created_from\"
... about 6300 chars
TTL为24小时,但是钥匙已有20天或更长时间了。什么原因是什么?
现在,我还尝试了
UNLINK "263384DB-61DD561800016316-240C0700"
(integer) 1
钥匙仍然存在。
In my redis database I have a key:
127.0.0.1:6379[5]> get "263384DB-61DD561800016316-240C0700"
"{\"json\":{\"created\":\"1641895448090335\",\"last_signal\":\"1641895448\",\"tos\":\"184\",\"deleted\":\"0\",\"num_sfds\":\"4\",\"num_streams\":\"4\",\"num_medias\":\"2\",\"num_tags\":\"2\",\"num_maps\":\"2\",\"ml_deleted\":\"0\",\"created_from\":
... about 6300 chars
I try
127.0.0.1:6379[5]> del "263384DB-61DD561800016316-240C0700"
(integer) 1
I also tried:
127.0.0.1:6379[5]> DEL `"263384DB-61DD561800016316-240C0700"`
Invalid argument(s)
127.0.0.1:6379[5]> DEL '"263384DB-61DD561800016316-240C0700"'
(integer) 0
but value is still there:
127.0.0.1:6379[5]> get "263384DB-61DD561800016316-240C0700"
"{\"json\":{\"created\":\"1641895448090335\",\"last_signal\":\"1641895448\",\"tos\":\"184\",\"deleted\":\"0\",\"num_sfds\":\"4\",\"num_streams\":\"4\",\"num_medias\":\"2\",\"num_tags\":\"2\",\"num_maps\":\"2\",\"ml_deleted\":\"0\",\"created_from\"
... about 6300 chars
TTL is 24 hours, but key is 20 or more days old. What could be the reason?
Now I also tried
UNLINK "263384DB-61DD561800016316-240C0700"
(integer) 1
key still exists.
如果你对这篇内容有疑问,欢迎到本站社区发帖提问 参与讨论,获取更多帮助,或者扫码二维码加入 Web 技术交流群。
绑定邮箱获取回复消息
由于您还没有绑定你的真实邮箱,如果其他用户或者作者回复了您的评论,将不能在第一时间通知您!
发布评论
评论(2)
我不确定为什么您在运行后继续尝试删除密钥:
并获得以下成功的结果:
为了调试它,启动另一个终端会话并运行Redis的
Monitor
命令:然后您可以看到所有命令都进入了Redis。
另外,尝试在原始会话中运行此操作,以查看键的“ lime live live” ,无论是在尝试删除密钥之前和之后:
I am not sure why you continue trying to delete your key after you run:
and get a successful result of:
In order to debug it, start another Terminal session and run Redis's
MONITOR
command:then you can see all the commands coming into Redis.
Also, try running this in your original session, to see the key's "Time-to-Live", both before and after attempting to delete the key:
马克的评论很有帮助。它接缝钥匙每5秒再次写入一次:(每隔几秒钟查询一次)
127.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(INTEGER)86395 127.0.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(INTEGER)86399 127.0.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(Integer)86398 127.0.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(Integer)86398 127.0.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(Integer)86398 127.0.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(INTEGER)86395 127.0.0.0.1:6379 [5]> TTL“ 263384DB-61DD561800016316-240C0700”(INTEGER)86397 127.0.0.0.1:6379 [5]> ttl“ 263384DB-61DD561800016316-240C0700”(Integer)86400
来自Redis-Cli监视器:
1651147523.327082 [5 “ 86400” 1651147528.326984 [5 127.0.0.1:53408]“设置”“ 263384DB-61DD561800016316-240C0700”“” {{\“ JSON \”:{\“ create \”:{\“ create \”:\“ 164189544809544809090335
...是编写密钥的软件(RTP引擎)
Comment from Mark was helpful. It seams the key is written again every 5 seconds: (Query every few seconds)
127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86395 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86399 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86398 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86398 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86398 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86395 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86397 127.0.0.1:6379[5]> ttl "263384DB-61DD561800016316-240C0700" (integer) 86400
from redis-cli MONITOR:
1651147523.327082 [5 127.0.0.1:53408] "EXPIRE" "263384DB-61DD561800016316-240C0700" "86400" 1651147528.326984 [5 127.0.0.1:53408] "SET" "263384DB-61DD561800016316-240C0700" "{\"json\":{\"created\":\"1641895448090335...
so this is not a REDIS issue, it is the software writing the keys (rtp engine)