本文整理汇总了PHP中Psr\Cache\CacheItemInterface::set方法的典型用法代码示例。如果您正苦于以下问题:PHP CacheItemInterface::set方法的具体用法?PHP CacheItemInterface::set怎么用?PHP CacheItemInterface::set使用的例子?那么恭喜您, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Psr\Cache\CacheItemInterface
的用法示例。
在下文中一共展示了CacheItemInterface::set方法的8个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: finalize
public function finalize()
{
$this->decorated->set((string) $this->iron->encrypt($this->password, json_encode($this->plaintext), $this->expiration ? time() - $this->expiration : 0));
}
示例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: cache
/**
* Minify the data & write it to a CacheItemInterface object.
*
* @param CacheItemInterface $item Cache item to write the data to.
* @return CacheItemInterface Cache item with the minifier data.
*/
public function cache(CacheItemInterface $item)
{
$content = $this->execute();
$item->set($content);
return $item;
}
示例4: handleSuccessfulResponse
/**
* @param ResponseInterface $response
* @param CacheItemInterface $item
* @param array|null $data
*
* @throws \RuntimeException
*
* @return array
*/
protected function handleSuccessfulResponse(ResponseInterface $response, CacheItemInterface $item = null)
{
switch ((int) $response->getStatusCode()) {
case 200:
$data = json_decode($response->getBody(), true);
if ($item !== null && $response->hasHeader('Last-Modified') === true) {
$item->set(['modified' => $response->getHeader('Last-Modified'), 'json' => $data]);
$this->cache->save($item);
}
return $data;
case 304:
return $item->get()['json'];
default:
throw new \RuntimeException('No support added for HTTP Status Code ' . $response->getStatusCode());
}
}
示例5: getObjectByKey
/**
* @param CacheItemInterface $cacheItem
* @param $key
*/
protected function getObjectByKey(CacheItemInterface $cacheItem, $key)
{
$transformedKey = $this->transformKey($key);
$status = $this->cache->get($transformedKey, $record);
if ($status == \Aerospike::OK) {
$cacheItem->set($record['bins'][self::AEROSPIKE_BIN]);
}
}
示例6: set
public function set($value)
{
$this->decorated->set($this->encrypt($value));
$this->decrypted = $value;
return $this;
}
示例7: 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;
}
示例8: set
/**
* {@inheritdoc}
*/
public function set($value)
{
$this->item->set($value);
return $this;
}