Skip to content

Commit

Permalink
Add example to documentation for Cache::remember()
Browse files Browse the repository at this point in the history
  • Loading branch information
markstory committed Oct 5, 2013
1 parent f146d43 commit cb91a2d
Showing 1 changed file with 12 additions and 1 deletion.
13 changes: 12 additions & 1 deletion lib/Cake/Cache/Cache.php
Expand Up @@ -549,9 +549,20 @@ public static function groupConfigs($group = null) {
* will be invoked. The results will then be stored into the cache config
* 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 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.
* Defaults to default.
*/
Expand Down

0 comments on commit cb91a2d

Please sign in to comment.