Closed
Description
Symfony version: 3.4.9
Reproducing:
$cache = new TagAwareAdapter($this->get('cache.app'));
$pagination = $cache->getItem(PostTypeDictionary::CACHE_MEDIA_PREFIX . $postType . $request->get('page', 1));
if (!$pagination->isHit()) {
$data = getSomeData();
$pagination->tag(
[
PostTypeDictionary::CACHE_MEDIA_PREFIX,
PostTypeDictionary::CACHE_MEDIA_PREFIX . $postType,
]
);
$pagination->set($data);
$cache->save($pagination);
} else {
$data = $pagination->get();
}
In redis i see two keys:
- "zG3lSHyaSM:\x00tags\x00cache.media.01"
- "zG3lSHyaSM:cache.media.01"
First contains: "a:2:{s:12:\"cache.media.\";i:0;s:13:\"cache.media.0\";i:0;}"
Second contains cache data;
Then i call cache clearing by tags:
(new TagAwareAdapter($this->get('cache.app')))->invalidateTags([PostTypeDictionary::CACHE_MEDIA_PREFIX]);
Redis store one more key "zG3lSHyaSM:cache.media.\x00tags\x00", which contains: "i:1;"
And that's all, old cache available.
Another cache adapters have the same problem.
What i'm doing wrong?