redis delete 1

redis delete

redis> SET key1 "Hello"
redis> SET key2 "World"
redis> DEL key1 key2 key3
(integer) 2

Here is what the above code is Doing:
1. We’re connecting to Redis on the localhost ( and port 6379.
2. We’re setting the key1 value to “Hello”.
3. We’re setting the key2 value to “World”.
4. We’re deleting the key1 and key2 keys.
5. We’re deleting the key3 key, but since it doesn’t exist, it’s not deleted.
6. We’re printing the number of keys that were deleted.

Similar Posts