文档:
packagist: https://packagist.org/packages/predis/predis
github: https://github.com/predis/predis
安装
composer require predis/predis
示例
<?php require __DIR__ . '/../vendor/autoload.php'; use Predis\Client; $client = new Client(); // 设置 $client->set('foo', 'bar'); // 获取 $value = $client->get('foo'); var_dump($value); // string(3) "bar"
设置缓存时间
// SET key value [EX seconds] [PX milliseconds] [NX|XX] $client->set($key, $value, 'EX', $expire);
参考