mirror of
https://github.com/kamilwylegala/cakephp2-php8.git
synced 2024-11-15 03:18:26 +00:00
Add example to documentation for Cache::remember()
This commit is contained in:
parent
f146d4334a
commit
cb91a2d33c
1 changed files with 12 additions and 1 deletions
|
@ -549,9 +549,20 @@ class Cache {
|
||||||
* will be invoked. The results will then be stored into the cache config
|
* will be invoked. The results will then be stored into the cache config
|
||||||
* at key.
|
* at key.
|
||||||
*
|
*
|
||||||
|
* Examples:
|
||||||
|
*
|
||||||
|
* Using a Closure to provide data, assume $this is a Model:
|
||||||
|
*
|
||||||
|
* {{{
|
||||||
|
* $model = $this;
|
||||||
|
* $results = Cache::remember('all_articles', function () use ($model) {
|
||||||
|
* return $model->find('all');
|
||||||
|
* });
|
||||||
|
* }}}
|
||||||
|
*
|
||||||
* @param string $key The cache key to read/store data at.
|
* @param string $key The cache key to read/store data at.
|
||||||
* @param callable $callable The callable that provides data in the case when
|
* @param callable $callable The callable that provides data in the case when
|
||||||
* the cache key is empty.
|
* the cache key is empty. Can be any callable type supported by your PHP.
|
||||||
* @param string $config The cache configuration to use for this operation.
|
* @param string $config The cache configuration to use for this operation.
|
||||||
* Defaults to default.
|
* Defaults to default.
|
||||||
*/
|
*/
|
||||||
|
|
Loading…
Reference in a new issue