traineratwot / cache
简单的缓存系统
3.0.2
2023-01-17 10:09 UTC
Requires
- php: ^8.1
- psr/simple-cache: ^3.0
- traineratwot/config: ^1.0
Requires (Dev)
- jetbrains/phpstorm-attributes: dev-master
- phpunit/phpunit: ^9.5
- roave/security-advisories: dev-latest
- traineratwot/composer-config: ^1.1
README
定义常量 WT_CACHE_PATH
以设置缓存文件夹。如果没有 WT_CACHE_PATH
,则保存到供应商目录
安装
composer require traineratwot/cache
示例
$key = ['key']; $value = ['value']; \Traineratwot\Cache\Cache::setCache($key,$value,600,'category/subcategory') \Traineratwot\Cache\Cache::getCache($key,$value,600,'category/subcategory') \Traineratwot\Cache\Cache::call($key,function($v) use ($key){ if(count($key) === 1){ return $v } return 'noValue' },600,'category/subcategory',$value) \Traineratwot\Cache\Cache::autoRemove() \Traineratwot\Cache\Cache::removeAll()