Repository navigation
Conversation
StorageMemcachedModule built the MemcachedAdapter that stores resources without a namespace and passed CacheNamespace to TagAwareAdapter, which has no such parameter. Entries stored under one CacheVersionModule version were therefore read under the next. Pass CacheNamespace to the MemcachedAdapter, as Psr6MemcachedModule and StorageRedisDsnModule do, and drop the name-map entry TagAwareAdapter ignored. The tags pool is the same adapter, so tag versions are kept per version too. Without CacheVersionModule the namespace stays empty. A version that holds a character Symfony reserves in a cache key, such as '/' or '@', now fails when the pool is built. clear() on this pool bumps the namespace version and never flushes the whole server; nothing in the package calls it.
TagAwareAdapter keeps tag versions under keys that hold control characters
("\1tags\1"). libmemcached's text protocol stores such keys but cannot read
them back, so every tagged entry, which is every resource entry, missed from
a new pool instance. Symfony's MemcachedAdapter requires the binary protocol
under TagAwareAdapter and enables it in createConnection(); the
MemcachedProvider of ray/psr-cache-module does not.
The resource pool's adapter takes a MemcachedProvider subclass that enables
the binary protocol, bound under the ResourceObjectPool qualifier, so the
application's Shared pool keeps the protocol it had.
The fake Memcached class defined when the extension is absent gains
setOption() and OPT_BINARY_PROTOCOL: PHPStan reads it in place of the
extension stub.
Root cause and verificationCache version. Protocol.
Tests against the 1.x
Both pass on this branch, as does the full suite (946 tests; 14 skipped for Redis and Windows). Injector paths. A compiled injector (ray/compiler) gives the resource pool a binary-protocol client, keeps the Not verified: a server or proxy that accepts only the text protocol. The READMEs of twemproxy and mcrouter list only the ASCII protocol; managed Memcached services were not checked. |
Codecov Report✅ All modified and coverable lines are covered by tests. Additional details and impacted files@@ Coverage Diff @@
## 1.x #333 +/- ##
===========================================
Coverage 100.00% 100.00%
- Complexity 885 886 +1
===========================================
Files 123 124 +1
Lines 1965 1971 +6
===========================================
+ Hits 1965 1971 +6 ☔ View full report in Codecov by Harness. 🚀 New features to boost your workflow:
|
|
@coderabbitai review |
|
No actionable comments were generated in the recent review. Walkthrough
Merge Risk:
|
Action not completed
|
Fixes two faults in the resource pool that
StorageMemcachedModulebinds.CacheVersionModulenamespace now reaches the pool'sMemcachedAdapter, so each version keeps its entries apart. It was passed toTagAwareAdapter, which takes no namespace.Memcachedclient uses the binary protocol. Over the text protocol, the tag version keysTagAwareAdapterwrites could not be read back, so every tagged entry missed. Only the resource pool changes; theSharedpool ofPsr6MemcachedModulekeeps its protocol.Users need a Memcached server, and any proxy in front of it, that accepts the binary protocol. A cache version must not contain any of
{}()/\@:. Both are noted in the CHANGELOG.tests-pecl-ext/StorageMemcachedModuleTest.phpcovers both against a running server.Root cause and verification: #333 (comment)
Summary by CodeRabbit