Skip to content

Commit a286c07

Browse files
committed
docs: clarify Memcached lock limitations
Signed-off-by: memleakd <121398829+memleakd@users.noreply.github.com>
1 parent 95ad08a commit a286c07

2 files changed

Lines changed: 12 additions & 7 deletions

File tree

user_guide_src/source/changelogs/v4.8.0.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ Libraries
225225

226226
- **Context**: This new feature allows you to easily set and retrieve normal or hidden contextual data for the current request. See :ref:`Context <context>` for details.
227227
- **Images:**: Added support for the AVIF file format.
228-
- **Locks:** Added :doc:`Atomic Locks </libraries/locks>` for owner-aware, cross-process mutual exclusion backed by supported cache handlers: **File**, **Redis**, **Predis**, and **Memcached**.
228+
- **Locks:** Added :doc:`Atomic Locks </libraries/locks>` for owner-aware, cross-process mutual exclusion backed by supported cache handlers: **File**, **Redis**, **Predis**, and **Memcached**. Memcached support has driver-specific release limitations because Memcached has no atomic compare-and-delete command.
229229
- **Logging:** Log handlers now receive the full context array as a third argument to ``handle()``. When ``$logGlobalContext`` is enabled, the CI global context is available under the ``HandlerInterface::GLOBAL_CONTEXT_KEY`` key. Built-in handlers append it to the log output; custom handlers can use it for structured logging.
230230
- **Logging:** Added :ref:`per-call context logging <logging-per-call-context>` with three new ``Config\Logger`` options (``$logContext``, ``$logContextTrace``, ``$logContextUsedKeys``). Per PSR-3, a ``Throwable`` in the ``exception`` context key is automatically normalized to a meaningful array. All options default to ``false``.
231231

user_guide_src/source/libraries/locks.rst

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,10 @@ critical section, and release it when the work is finished.
1919
Configuration
2020
*************
2121

22-
The Locks library uses the Cache service. The cache handler must support atomic
23-
lock operations. The built-in **File**, **Redis**, **Predis**, and
24-
**Memcached** cache handlers support locks.
22+
The Locks library uses the Cache service. The cache handler must support
23+
owner-aware lock operations. The built-in **File**, **Redis**, and **Predis**
24+
cache handlers support atomic lock operations. The **Memcached** cache handler
25+
also supports locks, with Memcached-specific limitations described below.
2526

2627
.. note:: Locks are most useful when all competing processes share the same cache
2728
storage. The File handler is suitable for a single server. For multiple
@@ -34,9 +35,13 @@ lock operations. The built-in **File**, **Redis**, **Predis**, and
3435
store for locks when that separation is important.
3536

3637
.. note:: Memcached lock support requires the ``memcached`` PHP extension.
37-
The older ``memcache`` extension does not provide the CAS operations needed
38-
for owner-aware release and refresh. Memcached locks may also be lost if the
39-
Memcached server restarts, evicts keys, or flushes its cache.
38+
The older ``memcache`` extension does not provide the CAS operations used
39+
for owner-aware refresh and best-effort release. Memcached does not provide
40+
an atomic compare-and-delete command, so releasing a Memcached lock cannot
41+
provide the same owner-checked atomic release guarantee as Redis or Predis.
42+
A delayed release may delete a lock that expired and was acquired by another
43+
owner. Memcached locks may also be lost if the Memcached server restarts,
44+
evicts keys, or flushes its cache.
4045

4146
.. note:: File-backed locks clear released and expired lock contents, but may
4247
leave empty lock files in the cache directory. These files do not represent

0 commit comments

Comments
 (0)