eecjimmy / basic
There is no license information available for the latest version (1.0) of this package.
basic development packages
1.0
2021-07-30 12:43 UTC
Requires
- php: >=7.0
Requires (Dev)
- ext-json: *
README
composer require eecjimmy/basic
namespace demo; use eecjimmy\Basic\CacheableTrait; class Demo { use CacheableTrait; public function getUser() { return $this->cacheGet(__METHOD__, function () { echo "cache missing...\n"; return 'user'; }); } public static function getStudent() { return self::cacheGetStatic(__METHOD__, function () { echo "cache missing...\n"; return 'student'; }); } public function getWithArgument($a) { $key = md5(__METHOD__ . json_encode(func_get_args())); return $this->cacheGet($key, function () { echo "cache missing...\n"; return 'with-argument'; }); } }