Suppose you have a LIST datatype in Redis. How do you delete all its entries? I’ve tried this already:
LTRIM key 0 0
LTRIM key -1 0
Both of those leave the first element. This will leave all the elements:
LTRIM key 0 -1
I don’t see a separate command to completely empty a list.
Delete the key, and that will clear all items. Not having the list at all is similar to not having any items in it. Redis will not throw any exceptions when you try to access a non-existent key.
Here’s some console logs.