Yii Framework Forum: How check if cache is present - Yii Framework Forum

Jump to content

Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

How check if cache is present Rate Topic: -----

#1 User is offline   emix 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 02-March 09
  • Location:Poland

Posted 08 September 2010 - 01:31 PM

Hi, I have a page with some news. The output is cached using fragment caching, but still the news in the controller are retrieved from cache/database. Is there any possiblity to check if my output cache is present so I could omit news fetching and just display the cached output?

I think there should be a method in CCache class to check the existence of cache:

if (! Yii::app()->cache->isset('cache_id')) {
   // just display cached output
}

0

#2 User is offline   emix 

  • Junior Member
  • Pip
  • Yii
  • Group: Members
  • Posts: 70
  • Joined: 02-March 09
  • Location:Poland

Posted 09 September 2010 - 05:24 AM

no1 replied so I had to manage myself
instead of fragment caching in view, I catched the output in the controller and cached it, then displayed it
0

Share this topic:


Page 1 of 1
  • You cannot start a new topic
  • You cannot reply to this topic

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