viloveul / cache
Viloveul 缓存。使用 apcu 和 redisclient 实现 psr/simple-cache
v1.0.6
2019-06-06 19:24 UTC
Requires
- php: ~7.0
- psr/simple-cache: ^1.0
Requires (Dev)
- codeception/codeception: ^2.5
- viloveul/support: v1.*
Suggests
- ext-apcu: For use apcu cache adapter
- ext-redis: For using redis adapter
README
确保你的 PHP 版本 > 7.0
composer require viloveul/cache
如何使用
require __DIR__ . '/vendor/autoload.php'; $adapter = new Viloveul\Cache\ApcuAdapter(); // or // $adapter = new Viloveul\Cache\RedisAdapter($host, $port); $adapter->setDefaultLifeTime(3600); $adapter->setPrefix('secret_maybe'); $cache = new Viloveul\Cache\Cache($adapter); $cache->set('hello', 'world'); var_dump($cache->get('hello', 'default_value'));