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 CLEAR is idempotent: it returns 1 the first time the flag is removed from a key, and 0 on later calls if the key didn't carry that flag.
  • Unlike BLESS SET, BLESS CLEAR isn't blocked when the server is out of memory, so protection can always be removed to free up eviction candidates.
  • BLESS CLEAR generates an unbless keyspace 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
❌ Active-Active
❌ Standard
❌ Active-Active

Return information

One of the following:

See also

BLESS SET | BLESS GET | BLESS SCAN

RATE THIS PAGE
Back to top ↑