Yii Framework Forum: Fragment Caching - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

Fragment Caching Rate Topic: -----

#1 User is offline   michaelGregoire 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 17-December 08

Posted 01 April 2010 - 08:50 AM

I'm trying to implement a "Clear Cache" feature that'll only clear particular assets. To do so, I'm making use of "Yii::app()->cache->delete('cache-key')". It doesn't seem to be working and I suspect I know why. Is this method able to delete cached fragments that were set with beginCache() in a view? If Yii::app()->cache->delete() is the wrong method to use, does anyone have any suggestions on how to delete a particular fragment cache?


Thanks
Mike
0

#2 User is offline   qiang 

  • Yii Project Lead
  • Yii
  • Group: Yii Dev Team
  • Posts: 5,857
  • Joined: 04-October 08
  • Location:DC, USA

Posted 02 April 2010 - 04:16 PM

The cache key generated by COutputCache could be very complex. Unless you know the generated key, you will not be able to delete it manually from the cache.

As a workaround, you may create a COutputCache object with exactly the same configuration you use previously and then set its duration to be 0.
0

#3 User is offline   michaelGregoire 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 34
  • Joined: 17-December 08

Posted 04 April 2010 - 07:03 PM

View Postqiang, on 02 April 2010 - 04:16 PM, said:

The cache key generated by COutputCache could be very complex. Unless you know the generated key, you will not be able to delete it manually from the cache.

As a workaround, you may create a COutputCache object with exactly the same configuration you use previously and then set its duration to be 0.


Thanks Qiang. That makes sense. I'll give that a shot.
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • This topic is locked

1 User(s) are reading this topic
0 members, 1 guests, 0 anonymous users