Ralf Viellieber
Ralf Viellieber

Reputation: 51

redis delete does not delete the key

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.

Upvotes: 3

Views: 4650

Answers (2)

Ralf Viellieber
Ralf Viellieber

Reputation: 51

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)

Upvotes: 1

Mark Setchell
Mark Setchell

Reputation: 207425

I am not sure why you continue trying to delete your key after you run:

server:6379> del "263384DB-61DD561800016316-240C0700"

and get a successful result of:

(integer) 1

In order to debug it, start another Terminal session and run Redis's MONITOR command:

redis-cli MONITOR

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:

server:6379> ttl "263384DB-61DD561800016316-240C0700"

Upvotes: 3

Related Questions