prowebcraft / yii2-lazy-cache
Lazy cache functions
Installs: 785
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
Type:yii2-extension
Requires
- php: >=8.0.0
This package is auto-updated.
Last update: 2024-11-23 18:18:29 UTC
README
Lazy cache functions
Usage
Attach Lazy trait to your class
<?php class HeavyJob { use \prowebcraft\yii2lazycache\Lazy; }
Wrap heavy data in lazy function
$rocketToMarsTrajectory = $this->lazyWithCache('mars.trajectory', function() { // this function will be called once a day $trajectory = null; // heavy calculation here return $trajectory; });