delboy1978uk/redis-cache

实现 PSR-16 (Simple Cache) 的 Redis 驱动器

1.0.1 2017-01-03 17:35 UTC

This package is auto-updated.

Last update: 2024-09-05 00:56:09 UTC


README

Build status Coverage Status

这是一个简单的 Redis 驱动器,实现了 PSR-16,与 PHP 5.3.3+ 兼容。

安装

使用 composer 安装

$ composer require naroga/redis-cache

就这些。

naroga/redis-cache 遵循 SemVer

使用方法

naroga/redis-cache 应使用 predis/predis 客户端进行构建。

您可以在此处查看 Predis 的文档:Predis' documentation here.

<?php

require_once "vendor/autoload.php";

use Naroga\RedisCache\Redis;
use Predis\Client;

$config = array(
    'scheme' => 'tcp',
    'host' => 'localhost',
    'port' => 6379
);

$redis = new Redis(new Client($config));

if (!$redis->has('myKey')) {
    $redis->set('myKey', 'myValue', 1800); //Just call any PSR-16 methods here.
}

许可

此库发布于 MIT 许可下。更多信息请查看 LICENSE.md