fredbradley / cacher
支持多框架的缓存接口。
v3.0.0
2022-04-13 16:04 UTC
Requires
- php: ^8.0
Requires (Dev)
- phpstan/phpstan: ^0.12.83
- phpunit/phpunit: ^9.5
- squizlabs/php_codesniffer: ^3.5
Suggests
- fredbradley/easytime: Easy human readable representation of seconds and minutes
README
在我的日常工作中,我经常与Laravel和WordPress一起工作。我还制作了需要与两者兼容的包。当涉及到缓存时,为每个框架编写if语句变得非常痛苦。因此,我创建了这个小脚本,为我做了这些工作。
安装
您可以通过composer安装此包
composer require fredbradley/cacher
用法
use FredBradley\Cacher; Cacher::remember('cache_key_name', 300, function() { // Your logic $value = "value"; return $value; }); /* * Will set the value of 'cache_key_name' to the return value of the Closure callback and * save in the cache for 5 minutes (300 seconds) */
这个类中只有很少几个方法。它非常基础,但非常奇妙!
测试
composer test
变更日志
有关最近更改的更多信息,请参阅变更日志。
贡献
有关详细信息,请参阅贡献指南。
安全性
如果您发现任何安全相关的问题,请通过电子邮件code@fredbradley.co.uk联系,而不是使用问题跟踪器。
鸣谢
许可证
MIT许可证(MIT)。有关更多信息,请参阅许可证文件。