當前位置: 首頁>>代碼示例>>PHP>>正文


PHP Craft::trace方法代碼示例

本文整理匯總了PHP中Craft::trace方法的典型用法代碼示例。如果您正苦於以下問題:PHP Craft::trace方法的具體用法?PHP Craft::trace怎麽用?PHP Craft::trace使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在Craft的用法示例。


在下文中一共展示了Craft::trace方法的1個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。

示例1: add

 /**
  * Stores a value identified by a key into cache if the cache does not contain this key.
  * Nothing will be done if the cache already contains the key.
  *
  * @param  string           $id         the key identifying the value to be cached
  * @param  mixed            $value      the value to be cached
  * @param  integer          $expire     the number of seconds in which the cached value will expire. 0 means never expire.
  * @param  ICacheDependency $dependency dependency of the cached item. If the dependency changes, the item is labeled invalid.
  * @return boolean                      true if the value is successfully stored into cache, false otherwise
  */
 public function add($id, $value, $expire = null, $dependency = null)
 {
     Craft::trace('Adding "' . $id . '" to cache', 'system.caching.' . get_class($this));
     if ($expire === null) {
         $expire = craft()->config->getCacheDuration();
     }
     if ($dependency !== null && $this->serializer !== false) {
         $dependency->evaluateDependency();
     }
     if ($this->serializer === null) {
         $value = serialize(array($value, $dependency));
     } elseif ($this->serializer !== false) {
         $value = call_user_func($this->serializer[0], array($value, $dependency));
     }
     $this->_originalKey = $id;
     return $this->addValue($this->generateUniqueKey($id), $value, $expire);
 }
開發者ID:kentonquatman,項目名稱:portfolio,代碼行數:27,代碼來源:FileCache.php


注:本文中的Craft::trace方法示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。