bkhrupa/kohana-rediscache

非常简单的 kohana3.3 版本 phpredis 缓存模块

安装次数: 200,964

依赖: 0

建议者: 0

安全性: 0

星标: 5

关注者: 3

分支: 2

开放问题: 0

类型: kohana-module

1.2.0 2015-02-25 22:50 UTC

This package is auto-updated.

Last update: 2024-09-24 01:15:48 UTC


README

非常简单的 kohana3.3 版本 phpredis 缓存模块 :) 需要 Kohana 缓存模块

Redis 客户端 - phpredis (https://github.com/nicolasff/phpredis)

原始模块 - (https://github.com/infarmer/phpredis-kohana3.3)

示例

启用模块 bootstrap.php

Kohana::modules(array(
    ...
    'cache' => MODPATH.'cache',
    'rediscache' => MODPATH.'rediscache',
    ...
));

配置。在 Kohana 缓存配置中添加 redis 驱动 config/cache.php

...
'redis' => array(
    'driver'             => 'redis',
    'port'               => 6379,
    'host'               => 'localhost',
    'db_num'             => 0,
    'igbinary_serialize' => false,
    'password'           => '',
),
...

如果默认需要 redis 缓存驱动 bootstrap.php

// default cache driver
Cache::$default = 'redis';

用法

$redis_cache = Cache::instance('redis');
$redis_cache->set('test_cache', array('foo', 'bar'), 10);
$redis_cache->get('test_cache');