/**
  * This method is overloaded from the base Elquent builder, so we can first see if the cached models already exist, and we can then bypass checking the database
  * entirely.
  *
  * @access public
  * @param  array  $columns
  * @return array
  */
 public function get($columns = array('*'))
 {
     $cachedModels = $this->findCachedModels();
     if (!empty($cachedModels)) {
         return $cachedModels;
     }
     $results = parent::get($columns);
     foreach ($results as $result) {
         SquirrelCache::remember($this->sourceModel, (array) $result);
     }
     return $results;
 }
示例#2
0
 /**
  * Store the object attributes in cache by it's cache keys.
  *
  * @access public 
  * @return null
  */
 public final function remember()
 {
     SquirrelCache::remember($this, $this->getAttributes());
 }