Open andrew-svirin opened 2 years ago
Do you mean somethinbg like the following?
$cache->multiSet(['key1' => 'val1', 'key2' => 'val2'], null, ['key1' => dependency1, 'key2' => dependency2]);
@samdark TagDependency or ChainedDependency
@samdark yes. yes definitely. dependency expect to be an TagDependency object
@samdark hold my tea (:
@winiarekk TagDependency or ChainedDependency are oriented to tag all values in multiSet()
with same logic. When all values should be tagged by its own logic, then to these classes can not solve the problem.
@andrew-svirin why you not store this complex cache in DB tables? you can update cache state by sheduler event(see CREATE EVENT ... ON SCHEDULE
in mysql) or by crontab task.
@WinterSilence I using interface CacheInterface, that adds many benefits. And the main goal is to getMultiple
values from Redis by one request and saveMultiple
missing in cache values by one request. In other words getOrSetMultiple()
@andrew-svirin this is where you should have started: "I'm use yii\redis\Cache
bla-bla-bla..." because this class in other package
It's not correct using multiSet()
, use set()
in cycle to set dependency for every values or extend yii\redis\Cache::multiSet()
to do this. If you explain current case/task more, we can try find optimal solution to do this.
Hi,
It is impossible to pass multiple dependencies per each key.
https://github.com/yiisoft/yii2/blob/master/framework/caching/Cache.php#L291
My goal is to use certain dependency for each key. It it very often usage.
For example I need to have next:
but now I can only make