Redis 4.0 UNLINK frees in the background

Redis is single-threaded, so DEL on a structure with a million members blocks every other client for as long as freeing it takes — which is milliseconds for a string and hundreds of milliseconds for a large hash.

DEL    session:index    # frees synchronously, blocks the server
UNLINK session:index    # removes the key now, frees in a background thread

# and the same choice for the whole database
FLUSHALL ASYNC

The key is unreachable immediately either way; only the memory reclamation moves. The cost is that peak memory is higher, because the freeing lags. There is a lazyfree-lazy-user-del setting that makes DEL behave as UNLINK globally, which is the right default for most workloads and is off by default for compatibility.