Answer the question
In order to leave comments, you need to log in
Yii2 how to set a cache key to delete the cache by this key later?
For example, there is a request
$data = Yii::$app->DB->createCommand('SELECT * FROM customer WHERE id=1')->cache(3600)->queryAll();
Yii::$app->cache->delete($key1);
$cache->set($key, $data, 45);
Answer the question
In order to leave comments, you need to log in
: Associates the item's cached data with one or more tags. You can invalidate the caching of given elements with the given tag(s) on a call.
Didn't find what you were looking for?
Ask your questionAsk a Question
731 491 924 answers to any question