pinga / cache
一个简单的缓存库,用于管理应用程序缓存的存储、加载和清除
v0.2
2023-03-13 09:41 UTC
Requires
- php: >=8.0
- ext-json: *
- ext-memcached: *
- ext-redis: *
Requires (Dev)
- laravel/pint: 1.2.*
- phpstan/phpstan: 1.9.x-dev
- phpunit/phpunit: ^9.3
- vimeo/psalm: 4.13.1
This package is auto-updated.
Last update: 2024-09-13 13:19:14 UTC
README
基于出色的 utopia-cache 和 scrawler-labs/swoole-cache
入门指南
使用 composer 安装
composer require pinga/cache
文件系统适配器
<?php require_once __DIR__ . '/../../vendor/autoload.php'; use Pinga\Cache\Cache; use Pinga\Cache\Adapter\Filesystem; $cache = new Cache(new Filesystem('/cache-dir')); $key = 'data-from-example.com'; $data = $cache->load($key, 60 * 60 * 24 * 30 * 3 /* 3 months */); if(!$data) { $data = file_get_contents('https://example.com'); $cache->save($key, $data); } echo $data;
版权和许可证
MIT 许可证 (MIT) https://open-source.org.cn/licenses/mit-license.php