@@ -107,8 +107,15 @@ session.save_path = "tcp://127.0.0.1:6379?auth[]=user&auth[]=password&prefix=use
107107
108108#### Session locking
109109
110- ** Support** : Locking feature is currently only supported for Redis setup with single master instance (e.g. classic master/slave Sentinel environment).
111- So locking may not work properly in RedisArray or RedisCluster environments.
110+ ** Support** : Session locking works for both the standalone ` redis ` and the
111+ ` rediscluster ` save handlers (Redis Cluster and Valkey Cluster). It may not
112+ work properly in RedisArray environments.
113+
114+ For the cluster handler the lock key always co-locates with the session
115+ data on a single slot via the Redis Cluster hash-tag rule, so the
116+ acquire-and-read step is a single atomic Lua script against the slot owner.
117+
118+ It is highly discouraged to use any Redis Cluster hash-tag within the prefix.
112119
113120The following INI variables can be used to configure session locking:
114121~~~
@@ -120,6 +127,28 @@ redis.session.lock_expire = 60
120127redis.session.lock_wait_time = 50000
121128; Maximum number of times to retry (-1 means infinite). Defaults to: 100
122129redis.session.lock_retries = 2000
130+ ; Optional: native conditional-delete primitive for releasing the lock.
131+ ; - DELIFEQ : Valkey 9.0+ (single round-trip, no Lua)
132+ ; - DELEX : Redis Open Source 8.4+ (single round-trip, no Lua)
133+ ; - unset : Lua compare-and-delete (where neither native primitive is available)
134+ ; redis.session.lock_release_cmd = DELIFEQ
135+ ~~~
136+
137+ Recommended config per backend:
138+ ~~~
139+ ; Valkey Cluster 9+
140+ session.save_handler = rediscluster
141+ redis.session.locking_enabled = 1
142+ redis.session.lock_release_cmd = DELIFEQ
143+
144+ ; Redis Cluster (Open Source) 8.4+
145+ session.save_handler = rediscluster
146+ redis.session.locking_enabled = 1
147+ redis.session.lock_release_cmd = DELEX
148+
149+ ; Anything else - leave lock_release_cmd unset
150+ session.save_handler = rediscluster
151+ redis.session.locking_enabled = 1
123152~~~
124153
125154#### Session compression
0 commit comments