public function cache($key, $config = 'default') { if ($this->_type !== 'select' && $this->_type !== null) { throw new RuntimeException('You cannot cache the results of non-select queries.'); } return $this->_cache($key, $config); }
public function findCached(Query $query, array $options) { if ($conditions = $query->clause('where')) { $query->cache(function ($q) use($conditions) { return $this->table() . '-' . md5(serialize($conditions)); }); } return $query; }