reaway / think-cache
think cache
Installs: 19
Dependents: 0
Suggesters: 0
Security: 0
Stars: 0
Watchers: 1
Forks: 0
Open Issues: 0
pkg:composer/reaway/think-cache
Requires
- php: >=8.0
- psr/simple-cache: ^1.0|^2.0|^3.0
- reaway/think-config: ^8.0
- reaway/think-container: ^8.0
- reaway/think-manager: ^8.0
README
安装
composer require reaway/think-cache
用法
use Think\Component\Cache\Facade\Cache; require __DIR__ . DIRECTORY_SEPARATOR . 'vendor' . DIRECTORY_SEPARATOR . 'autoload.php'; Cache::setConfig([ 'default' => 'file', 'stores' => [ 'file' => [ 'type' => 'File', // 缓存保存目录 'path' => __DIR__ . DIRECTORY_SEPARATOR . 'cache' . DIRECTORY_SEPARATOR, // 缓存前缀 'prefix' => '', // 缓存有效期 0表示永久缓存 'expire' => 0, ], 'redis' => [ 'type' => 'redis', 'host' => '127.0.0.1', 'port' => 6379, 'prefix' => '', 'expire' => 0, ], ], ]); Cache::set('key', 'value'); Cache::get('key');
文档
详细参考 缓存处理