UK [del] US [del]
n. Differential operator, inverted triangle
redis DEL command syntax
Function:Delete one or more given keys. Keys that do not exist will be ignored.
Syntax: DEL key [key ...]
Available versions: >= 1.0.0
Time complexity: O(N), N is the number of deleted keys. Deleting a single string type key has a time complexity of O(1). To delete a single list, set, ordered set or hash table type key, the time complexity is O(M), where M is the number of elements in the above data structure.
Return: The number of deleted keys.
redis DEL command example
# 删除单个 key redis> SET name huangz OK redis> DEL name (integer) 1 # 删除一个不存在的 key redis> EXISTS phone (integer) 0 redis> DEL phone # 失败,没有 key 被删除 (integer) 0 # 同时删除多个 key redis> SET name "redis" OK redis> SET type "key-value store" OK redis> SET website "redis.com" OK redis> DEL name type website (integer) 3