skip to Main Content

I’m trying to delete this key

local::1:global:queries:/search/issues?version=1.9&search=&limit=20&offset=0&category=1152:count

from my Redis database using the DEL command, but it will not delete. It just returns 0.

I’m able to delete other keys that are much simpler i.e. local::1:global:categories:1152 without a problem.

I’m trying to remove this key using the NodeJS Redis library via client.del(key)

The value of the key is very simple.
[{"count":"20"}]

2

Answers


  1. You will need to quote the key, depending on how you are deleting it.

    Via redis-cli in terminal:

    del `local::1:global:queries:/search/issues?version=1.9&search=&limit=20&offset=0&category=1152:count`
    
    Login or Signup to reply.
  2. In your case matching pattern will work due to “/search/issues?version=1.9&search=&limit=20&offset=0&category=1152”

    enter image description here

    So you can run do it through Lua scripts (redis 2.6.0^)

    here is more Information

    EVAL "return redis.call('del', unpack(redis.call('keys', KEYS[1])))"  1 local:*
    

    Or using bash

    redis-cli KEYS "local:*" | xargs redis-cli DEL
    
    Login or Signup to reply.
Please signup or login to give your own answer.
Back To Top
Search