@@ 184-199 (lines=16) @@ | ||
181 | * |
|
182 | * @return mixed |
|
183 | */ |
|
184 | public function paginate($limit = null, $columns = ['*']) |
|
185 | { |
|
186 | ||
187 | if (!$this->allowedCache('paginate') || $this->isSkippedCache()) { |
|
188 | return parent::paginate($limit, $columns); |
|
189 | } |
|
190 | ||
191 | $key = $this->getCacheKey('paginate', func_get_args()); |
|
192 | ||
193 | $minutes = $this->getCacheMinutes(); |
|
194 | $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($limit, $columns) { |
|
195 | return parent::paginate($limit, $columns); |
|
196 | }); |
|
197 | ||
198 | return $value; |
|
199 | } |
|
200 | ||
201 | /** |
|
202 | * Find data by id. |
|
@@ 209-223 (lines=15) @@ | ||
206 | * |
|
207 | * @return mixed |
|
208 | */ |
|
209 | public function find($id, $columns = ['*']) |
|
210 | { |
|
211 | ||
212 | if (!$this->allowedCache('find') || $this->isSkippedCache()) { |
|
213 | return parent::find($id, $columns); |
|
214 | } |
|
215 | ||
216 | $key = $this->getCacheKey('find', func_get_args()); |
|
217 | $minutes = $this->getCacheMinutes(); |
|
218 | $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($id, $columns) { |
|
219 | return parent::find($id, $columns); |
|
220 | }); |
|
221 | ||
222 | return $value; |
|
223 | } |
|
224 | ||
225 | /** |
|
226 | * Find data by field and value. |
|
@@ 234-248 (lines=15) @@ | ||
231 | * |
|
232 | * @return mixed |
|
233 | */ |
|
234 | public function findByField($field, $value = null, $columns = ['*']) |
|
235 | { |
|
236 | ||
237 | if (!$this->allowedCache('findByField') || $this->isSkippedCache()) { |
|
238 | return parent::findByField($field, $value, $columns); |
|
239 | } |
|
240 | ||
241 | $key = $this->getCacheKey('findByField', func_get_args()); |
|
242 | $minutes = $this->getCacheMinutes(); |
|
243 | $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($field, $value, $columns) { |
|
244 | return parent::findByField($field, $value, $columns); |
|
245 | }); |
|
246 | ||
247 | return $value; |
|
248 | } |
|
249 | ||
250 | /** |
|
251 | * Find data by multiple fields. |
|
@@ 258-272 (lines=15) @@ | ||
255 | * |
|
256 | * @return mixed |
|
257 | */ |
|
258 | public function findWhere(array $where, $columns = ['*']) |
|
259 | { |
|
260 | ||
261 | if (!$this->allowedCache('findWhere') || $this->isSkippedCache()) { |
|
262 | return parent::findWhere($where, $columns); |
|
263 | } |
|
264 | ||
265 | $key = $this->getCacheKey('findWhere', func_get_args()); |
|
266 | $minutes = $this->getCacheMinutes(); |
|
267 | $value = $this->getCacheRepository()->remember($key, $minutes, function () use ($where, $columns) { |
|
268 | return parent::findWhere($where, $columns); |
|
269 | }); |
|
270 | ||
271 | return $value; |
|
272 | } |
|
273 | ||
274 | /** |
|
275 | * Find data by Criteria. |