本文整理匯總了PHP中Psr\Cache\CacheItemInterface::expiresAfter方法的典型用法代碼示例。如果您正苦於以下問題:PHP CacheItemInterface::expiresAfter方法的具體用法?PHP CacheItemInterface::expiresAfter怎麽用?PHP CacheItemInterface::expiresAfter使用的例子?那麽, 這裏精選的方法代碼示例或許可以為您提供幫助。您也可以進一步了解該方法所在類Psr\Cache\CacheItemInterface
的用法示例。
在下文中一共展示了CacheItemInterface::expiresAfter方法的5個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的PHP代碼示例。
示例1: expiresAfter
public function expiresAfter($time)
{
if ($time instanceof DateInterval) {
$this->expiration = (new DateTime())->add($time)->getTimestamp();
} elseif (is_int($time)) {
$this->expiration = time() + $time;
}
$this->decorated->expiresAfter($time);
return $this;
}
示例2: generateNewTagId
/**
* A TagId is retrieved from cache using the TagKey.
*
* @param \Psr\Cache\CacheItemPoolInterface $storage
* @param CacheItemInterface $item
*
* @return string
*/
private function generateNewTagId(CacheItemInterface $item)
{
$value = str_replace('.', '', uniqid('', true));
$item->set($value);
$item->expiresAfter(null);
$this->save($item);
// Save to temporary tag store
$this->tags[$item->getKey()] = $value;
return $value;
}
示例3: generateNewTagId
/**
* A TagId is retrieved from cache using the TagKey.
*
* @param \Psr\Cache\CacheItemPoolInterface $storage
* @param CacheItemInterface $item
*
* @return string
*/
private function generateNewTagId(CacheItemInterface $item)
{
$value = str_replace('.', '', uniqid('', true));
$item->set($value);
$item->expiresAfter(null);
$this->save($item);
return $value;
}
示例4: expiresAfter
public function expiresAfter($expiresAfter)
{
$this->decorated->expiresAfter($expiresAfter);
return $this;
}
示例5: expiresAfter
/**
* {@inheritdoc}
*/
public function expiresAfter($time)
{
$this->item->expiresAfter($time);
return $this;
}