Yii Framework Forum: Interval Constants Inside Ccache - Yii Framework Forum

Jump to content

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

Interval Constants Inside Ccache

#1 User is offline   shoaibi 

  • Newbie
  • Yii
  • Group: Members
  • Posts: 16
  • Joined: 08-June 11
  • Location:Islamabad, Pakistan

Posted 07 December 2012 - 02:41 AM

Over the development of yii meanings of sending 0 or -1 as duration to cache components have varied. Though its not difficult to remember these mappings but some sort of constants would appeal more, specially in terms of code readability to a new developer, that is:

$this->beginCache($id, array('duration' => CCache::DISABLE));

is better than:
$this->beginCache($id, array('duration' => 0));


Few of the constants that i could think are:
  • DISABLE (same as 0)
  • PURGE_DISABLE (same as -1)
  • FOREVER (same as specifying a month or 2, this could actually depending on cache component like for APC it could be 7 days, for file it could be a month)



Credit: cpamplona on #yii
Original Post: http://www.yiiframew...ever-made-easy/
1

#2 User is offline   samdark 

  • Having fun
  • Yii
  • Group: Yii Dev Team
  • Posts: 3,390
  • Joined: 17-January 09
  • Location:Russia

Posted 07 December 2012 - 02:57 AM

Agree. I think it can be done in 1.1 in case of cache but it's definitely the style we'll follow for Yii2.
Yii 1.1 Application Development Cookbook

Enjoying Yii? Star us at github: 1.1 and 2.0.
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