perf(cache): use redis unlink for key deletion (#10658)

# Which Problems Are Solved

The usage of the Redis `DEL` command showed blocking and slowdowns
during load-tests.

# How the Problems Are Solved

Use [`UNLINK`](https://redis.io/docs/latest/commands/UNLINK/) instead.

# Additional Changes

- none

# Additional Context

- closes https://github.com/zitadel/zitadel/issues/8930

(cherry picked from commit a06ae2c835)
This commit is contained in:
Tim Möhlmann
2025-09-08 11:21:32 +03:00
committed by Livio Spring
parent 5d3e01bb6e
commit 64bddb328c

View File

@@ -3,8 +3,8 @@ local function remove(object_id)
local keys = redis.call("SMEMBERS", setKey)
local n = #keys
for i = 1, n do
redis.call("DEL", keys[i])
redis.call("UNLINK", keys[i])
end
redis.call("DEL", setKey)
redis.call("DEL", object_id)
redis.call("UNLINK", setKey)
redis.call("UNLINK", object_id)
end