/** * @return int */ public function count() { $key = 'entry_count'; if ($this->cache->has($key)) { return $this->cache->get($key); } $result = $this->eloquent->count(); $this->cache->put($key, $result); return $result; }
/** * @param $id * * @return mixed */ public function allByEntry($id) { $cacheKey = "comments:{$id}"; if ($this->cache->has($cacheKey)) { return $this->cache->get($cacheKey); } $result = $this->eloquent->getAllByEntryId($id); if ($result) { $this->cache->put($cacheKey, $result); } return $result; }