I have 3 dummy keys stored in my local redis server.
redis 127.0.0.1:6379> keys *
1) "key2"
2) "key3"
3) "key1"
When I try to fetch the same results from bash it returns "(empty list or set)" . Why?
$ redis-cli keys *
(empty list or set)
There are two major commands to delete the keys present in Redis: FLUSHDB and FLUSHALL. We can use the Redis CLI to execute these commands. The FLUSHDB command deletes the keys in a database. And the FLUSHALL command deletes all keys in all databases.
Redis Doesn't Store Empty Sets Or Hashes (And Will Delete Empty Sets And Hashes)
To answer your second question, (nil) or (empty list or set) is just an interpretation of the client program. In the Redis server, in both cases, the entry has been physically removed, and the associated memory freed.
The easiest way to clear Redis cache is to use the redis-cli command. Databases in Redis are stored individually. Using the redis-cli command allows you to either clear the keys from all databases, or from a single specified database only.
Awww. Just remembered that '*' has special meaning in bash. So
redis-cli keys \*
works.
Note: Not sure if the community would down vote but leaving this question for some poor soul who may be stuck as I was..
If you love us? You can donate to us via Paypal or buy me a coffee so we can maintain and grow! Thank you!
Donate Us With