本文整理匯總了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);
}