Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit405f64b

Browse files
wucdbmnicolas-grekas
authored andcommitted
[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.
1 parent12f5636 commit405f64b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

‎src/Symfony/Component/Cache/Adapter/AbstractAdapter.php‎

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -426,6 +426,9 @@ private function generateItems($items, &$keys)
426426

427427
try {
428428
foreach ($itemsas$id =>$value) {
429+
if (!isset($keys[$id])) {
430+
$id =key($keys);
431+
}
429432
$key =$keys[$id];
430433
unset($keys[$id]);
431434
yield$key =>$f($key,$value,true);

‎src/Symfony/Component/Cache/Adapter/TagAwareAdapter.php‎

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -261,7 +261,7 @@ private function generateItems($items, array $tagKeys)
261261

262262
foreach ($itemsas$key =>$item) {
263263
if (!$tagKeys) {
264-
yield$key =>isset($invalidKeys[self::TAGS_PREFIX.$key]) ?$f($key,null,$item) :$item;
264+
yield$key =>isset($invalidKeys[static::TAGS_PREFIX.$key]) ?$f($key,null,$item) :$item;
265265
continue;
266266
}
267267
if (!isset($tagKeys[$key])) {
@@ -287,7 +287,7 @@ private function generateItems($items, array $tagKeys)
287287
$itemTags =$tagVersions =$tagKeys =null;
288288

289289
foreach ($bufferedItemsas$key =>$item) {
290-
yield$key =>isset($invalidKeys[self::TAGS_PREFIX.$key]) ?$f($key,null,$item) :$item;
290+
yield$key =>isset($invalidKeys[static::TAGS_PREFIX.$key]) ?$f($key,null,$item) :$item;
291291
}
292292
$bufferedItems =null;
293293
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp