示例#1
0
 /**
  * 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
0
 /**
  * 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;
 }