merexo / rediska
测试。包含Redis PHP预定义方法的包
v0.3.4
2022-12-12 19:52 UTC
Requires
- php: >=7.1
- ext-redis: *
README
Redis的composer测试包。
安装
通过 Composer 安装
composer require merexo/rediska
主机/端口
默认值:主机 = 'localhost',端口 = 6379。如果您有.env文件,可以使用null, null
作为主机和端口的参数。在这种情况下,客户端将使用$_ENV['REDIS_HOST']
作为主机和$_ENV['REDIS_PORT']
作为端口。
示例
$client = new \Merexo\Rediska\Client(null, null); // try to take params from .env
默认使用
$client = new \Merexo\Rediska\Client; $client->cache()->set('key', 'my_value'); echo $client->cache()->get('key'); ... $stream = $client->stream('stream_key'); $key = $stream->add(['key' => 'value', 'object' => new \StdClass]); print_r($stream->get($key)); // response: ['key' => 'value', 'object' => new \StdClass] $stream->flush();