/** * @param int $page * @param int $limit * * @return mixed|\StdClass */ public function byPage($page = 1, $limit = 20) { // ページごとにキャッシュさせるように変更し、高速に動作させます $key = "entry_page:{$page}:{$limit}"; if ($this->cache->has($key)) { return $this->cache->get($key); } return $this->cache->putPaginateCache($page, $limit, $this->count(), $this->eloquent->byPage($limit, $page), $key); }
/** * @param int $page * @param int $limit * * @return \stdClass */ public function byPage($page = 1, $limit = 20) { $key = "entry_page:{$page}:{$limit}"; if ($this->cache->has($key)) { return $this->cache->get($key); } $entries = $this->eloquent->byPage($limit, $page); return $this->cache->putPaginateCache($page, $limit, $this->count(), $entries, $key); }