prowebcraft / yii2-lazy-cache
Lazy cache functions
Installs: 750
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-10-23 18:09:57 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; });