[Cache] MemcachedAdapter not working with TagAwareAdapter
It seems that when MemcachedAdapter is used with TagAwareAdapter, it fails to fetch items, even though I thoroughly tested fetching items with the exact same keys under the same namespace. Turns out the issue lies in `const TAGS_PREFIX = "\0tags\0";` for unknown to me reasons. Hardcoding that to '__tags__' in my project did the trick and I've been using it for a couple of days now and it seems fine. The reason I had to completely copy/paste this file in my local project is self:: instead of static:: usage. I am not sure whether that is a mistake or is done on purpose, but in order to have this work for me I need to be able to override that constant. Going with static:: seems like a good solution to me, then I can set whatever prefix I need for the tags.
This commit is contained in:
parent
12f5636eae
commit
405f64bb01
@ -426,6 +426,9 @@ abstract class AbstractAdapter implements AdapterInterface, LoggerAwareInterface
|
||||
|
||||
try {
|
||||
foreach ($items as $id => $value) {
|
||||
if (!isset($keys[$id])) {
|
||||
$id = key($keys);
|
||||
}
|
||||
$key = $keys[$id];
|
||||
unset($keys[$id]);
|
||||
yield $key => $f($key, $value, true);
|
||||
|
@ -261,7 +261,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface
|
||||
|
||||
foreach ($items as $key => $item) {
|
||||
if (!$tagKeys) {
|
||||
yield $key => isset($invalidKeys[self::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item;
|
||||
yield $key => isset($invalidKeys[static::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item;
|
||||
continue;
|
||||
}
|
||||
if (!isset($tagKeys[$key])) {
|
||||
@ -287,7 +287,7 @@ class TagAwareAdapter implements TagAwareAdapterInterface
|
||||
$itemTags = $tagVersions = $tagKeys = null;
|
||||
|
||||
foreach ($bufferedItems as $key => $item) {
|
||||
yield $key => isset($invalidKeys[self::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item;
|
||||
yield $key => isset($invalidKeys[static::TAGS_PREFIX.$key]) ? $f($key, null, $item) : $item;
|
||||
}
|
||||
$bufferedItems = null;
|
||||
}
|
||||
|
Reference in New Issue
Block a user