本文整理汇总了PHP中Illuminate\Database\Connection::getCacheManager方法的典型用法代码示例。如果您正苦于以下问题:PHP Connection::getCacheManager方法的具体用法?PHP Connection::getCacheManager怎么用?PHP Connection::getCacheManager使用的例子?那么, 这里精选的方法代码示例或许可以为您提供帮助。您也可以进一步了解该方法所在类Illuminate\Database\Connection
的用法示例。
在下文中一共展示了Connection::getCacheManager方法的2个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的PHP代码示例。
示例1: getCached
/**
* Execute the query as a cached "select" statement.
*
* @param array $columns
* @return array
*/
public function getCached($columns = array('*'))
{
list($key, $minutes) = $this->getCacheInfo();
// If the query is requested ot be cached, we will cache it using a unique key
// for this database connection and query statement, including the bindings
// that are used on this query, providing great convenience when caching.
$cache = $this->connection->getCacheManager();
$callback = $this->getCacheCallback($columns);
return $cache->remember($key, $minutes, $callback);
}
示例2: getCache
/**
* Get the cache object with tags assigned, if applicable.
*
* @return \Illuminate\Cache\CacheManager
*/
protected function getCache()
{
$cache = $this->connection->getCacheManager();
return $this->cacheTags ? $cache->tags($this->cacheTags) : $cache;
}