BLESS CLEAR
BLESS CLEAR key NO-EVICT
- Available since:
- Redis Open Source 8.12.0
- Time complexity:
- O(1)
- ACL categories:
-
@dangerous,@write,@fast, - Compatibility:
- Redis Software and Redis Cloud compatibility
BLESS CLEAR removes a protection flag from a key, making it eligible again for eviction. The key must already exist.
Required arguments
key
The name of the key to unprotect. The key must already exist, or the command returns an error.
NO-EVICT
The protection flag to remove. NO-EVICT is currently the only supported flag.
Details
Behavior
BLESS CLEARis idempotent: it returns1the first time the flag is removed from a key, and0on later calls if the key didn't carry that flag.- Unlike
BLESS SET,BLESS CLEARisn't blocked when the server is out of memory, so protection can always be removed to free up eviction candidates. BLESS CLEARgenerates anunblesskeyspace notification event.- Clearing the flag persists across restarts and replicates like any other write.
Examples
redis> BLESS SET session:42 NO-EVICT (integer) 1 redis> BLESS CLEAR session:42 NO-EVICT (integer) 1 redis> BLESS CLEAR session:42 NO-EVICT (integer) 0 redis> BLESS CLEAR missing-key NO-EVICT (error) ERR no such key
Redis Software and Redis Cloud compatibility
| Redis Software |
Redis Cloud |
Notes |
|---|---|---|
| ❌ Standard |
❌ Standard |
Return information
One of the following:
- Integer reply:
1if the flag was removed,0if the key didn't have it. - Simple error reply if the key doesn't exist.
See also
BLESS SET | BLESS GET | BLESS SCAN