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