Airship\Engine\Contract\CacheInterface::set PHP Method

set() public method

Set a cache entry
public set ( string $key, $value ) : mixed
$key string
$value
return mixed
    public function set(string $key, $value);

Usage Example

Example #1
0
 /**
  * @param CacheInterface $cache
  * @param string $uniqueID
  */
 protected function fetchComments(CacheInterface $cache, string $uniqueID)
 {
     $blog = $this->blog->getBlogPostByUniqueId($uniqueID);
     $comments = $this->blog->getCommentTree((int) $blog['postid']);
     $contents = $this->lensRender('blog/comments', ['blogpost' => $blog, 'comments' => $comments, 'config' => $this->config()]);
     $cache->set($uniqueID, ['status' => 'OK', 'cached' => $contents]);
     \Airship\json_response(['status' => 'OK', 'cached' => $contents]);
 }
CacheInterface