Invalidace cache pomocí tagu mi nefunguje

Rndoom04
Člen | 72
+
0
-

Dobrý večer,
prosím o radu jak správně invalidovat cache na základě tagu. Nijak to nic nedělá a nedokážu dopátrat, co s tím.

public function getPosledniClanky($limit=10) {
        return $this->cache->load($this->cache_klice['blog_getPosledniClanky'], function () use($limit) {
            $dependencies[Cache::EXPIRE] = '30 days';
            $dependencies[Cache::SLIDING] = true;
            $dependencies[Cache::TAGS] = ["blog_getPosledniClanky"];

            return $this->database->fetchAll("magická selekce");
        });
    }

Invalidaci se pak snažím provést pomocí:

$this->cache->clean([ Cache::TAGS => ["blog_getPosledniClanky"] ]);

No, ale nic se nestane. Pokud provdu invalidaci pomocí:

$this->cache->clean([ Cache::All=> true ]);

Tak to funguje. Ale to není ta cesta.

Četl jsem, že mám mít nastavený journal, ale to mi hlásí chybu když se ho pokusím nastavit (soubor journal.s3db jinak existuje celou dobu).

Service 'database.default.structure' (type of Nette\Database\Structure): Multiple services of type Nette\Caching\Storage found: cache.storage, cacheJournal. If you want to overwrite service cache.storage, give it proper name. (required by $cacheStorage in Structure::__construct())

Co s tím prosím? :)

Kamil Valenta
Člen | 762
+
+2
-
return $this->cache->load($this->cache_klice['blog_getPosledniClanky'], function (&$dependencies) use($limit) {
            $dependencies[Cache::EXPIRE] = '30 days';
            $dependencies[Cache::SLIDING] = true;
            $dependencies[Cache::TAGS] = ["blog_getPosledniClanky"];

            return $this->database->fetchAll("magická selekce");
        });
Rndoom04
Člen | 72
+
0
-

Kamil Valenta napsal(a):

return $this->cache->load($this->cache_klice['blog_getPosledniClanky'], function (&$dependencies) use($limit) {
            $dependencies[Cache::EXPIRE] = '30 days';
            $dependencies[Cache::SLIDING] = true;
            $dependencies[Cache::TAGS] = ["blog_getPosledniClanky"];

            return $this->database->fetchAll("magická selekce");
        });

A jsme doma. Moc děkuji! Toto jsem celou dobu úspěšně přehlížel.