1 | <?php |
||
19 | trait LazyCacheTrait |
||
20 | { |
||
21 | /** |
||
22 | * Performs lazy caching. If $cacheKey is not found in cache - run callable and cache result. |
||
23 | * Callable is called only if no cache entry |
||
24 | * |
||
25 | * @param callable $callable Callable to run for actual retrieving your info |
||
26 | * @param string $cacheKey Cache key string |
||
27 | * @param int $duration Duration of cache entry in seconds |
||
28 | * @param null|\yii\caching\Dependency|string $dependency Cache dependency |
||
29 | * |
||
30 | * @return mixed |
||
31 | */ |
||
32 | 1 | public function lazy(callable $callable, $cacheKey, $duration = 86400, $dependency = null) |
|
57 | } |