Hello,
I am new to Yii, only have been using it for 3-4 months.
I am currently developing a "preview" mode for my site. I wish to use the same controller views as I do for regular pageviews, so I dont have to duplicate files or code. I have fragment caching enabled all over these views, and this prevents content admins from seeing their changes when previewing pages they make.
I am using the CMemcache class for caching. What id ideally like to do is, for a single request (to a preview-mode pageview), change the cache to CDummyCache. I dont think I can do this anywhere but the config.
Ive tried to unset(Yii::app()->cache); but of course, this throws a PHP "object is read only" error.
Ive tried to unset the cache component via Yii::app()->setComponent(‘cache’, NULL); which should, in theory, remove the cache component. A subsequent call to Yii::app()->getComponents does show the cache has been nullified, however, its most certainly still working.
Ive also tried to instantiate a new CDummyCache, which produces the same object read only error.
Id rather not put conditional statements around my many fragment caching calls, to detect preview mode, as my site often has 2-3k concurrent users, and it would be unnecessary logic given the relatively low number of preview requests to the same view file. Id also rather not create a separate cache key for preview mode (with ttl of 0) as I feel simply unsetting the cache is more elegant.
Is there another way to unset the cache for just a single request? Ive been scouring the web all afternoon, and am arriving at the assumption that there is not.
Thanks for any help anyone can provide.