Symfony + Redis - how to search by tag

Since version 3.x Symfny supports Redis as a cache .

It works fine, but only if I want to get some data from the cache, for example:

$redis = $this->get('cache.app');

$cached = $redis->getItem('video#32');
$data = $cached->get();

if (!$cached->isHit()) {
    $cached->set([
        'users' => [
            $userId => [
                'username' => $userName,
                'refresh' => new \DateTime()
            ]
        ]
    ])->tag('stack, overflow, symfony, support');
    $redis->save($cached);
}

      

Is it possible to search / find all lines from the cache with the stack

and tag support

? I have searched for it in the symfony docs but there is no information about it. If this is not possible, when and how should I use tags if I cannot use them for searches?

btw: there is information we should use TaggedCacheItemInterface

, but after a few days this was omitted here

+3


source to share





All Articles