bkhrupa/kohana-rediscache

Very simple phpredis cache module for kohana3.3

Installs: 202 180

Dependents: 0

Suggesters: 0

Security: 0

Stars: 5

Watchers: 3

Forks: 2

Open Issues: 0

Type:kohana-module

1.2.0 2015-02-25 22:50 UTC

This package is auto-updated.

Last update: 2024-10-24 01:36:59 UTC


README

Very simple cache module phpredis for kohana3.3 :) Require Kohana Cache module

Redis client - phpredis (https://github.com/nicolasff/phpredis)

Original module - (https://github.com/infarmer/phpredis-kohana3.3)

Example

Enable module bootstrap.php

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

Config. Add to Kohana cache config redis driver config/cache.php

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

If redis by default cache driver needed bootstrap.php

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

Usage

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