I am trying to make dependency's work using Craft Cache (set to Redis.)

I've tried:

craft()->cache->set('cache_key', 'cache_value', 0, new CFileCacheDependency('dependent_cache_key'));

This stores the cache. However, when I then update the value for cache with the key name dependent_cache_key, cache_key does not invalidate.

Is CFileCacheDependency not the right way to attach dependency to a cache key? All the YII description says is "File Name."

Also, is it possible to declare directories for Craft Cache? I see YII also has a dependency method for directories CDirectoryCacheDependency, which would be optimal in my case, but I have no idea how to assign a directory for cache using craft()->cache->set() and craft->cache->get()

Any help would be incredibly appreciated. Been stumped crawling through yii docs to figure this out.


Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Browse other questions tagged or ask your own question.