FROZEN - Redis for Kohana
Switch branches/tags
Nothing to show
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Failed to load latest commit information.

PHPRedis for Kohana

Kohana is an elegant, open source, and object oriented HMVC framework built using PHP5, by a team of volunteers. It aims to be swift, secure, and small.

PHPRedis is an extension providing an API for communicating with the Redis key-value store. It is compiled in C.

PHPRedis for Kohana combines PHPRedis into Kohana modeled after the Database module design.


Kohana's documentation can be found at which also contains an API browser.

Installing PHPRedis can be found at


First, ensure you install PHPRedis and have a working Kohana environment.

Inside /application/bootstrap.php: Add this line in the modules listing (There will be similar entries near it):

'redis'		=> MODPATH . 'redis',

Add this line around where the Cookie::salt area is:

Session::$default = 'redis';

Much like Kohana's database configuration, create a file inside /application/config/ called redis.php Change this file to reflect the settings your redis is using (by default, it connects locally).

Setup Verification

Assuming you have a local redis instance going for development, in a command line, type in:


This should occur in a prompt like so:>

Inside this prompt, you can type:> keys *
(empty list or set)

To see all keys currently stored inside redis. It should be empty. If, inside a controller action you do a call to:

Session::instance()->set('test', 'key');

You should now get result data.> keys *
1) "554d4651b9dba6-79472033"

This means a key exists with session data as intended.

You can confirm the expiration using> ttl 554d4651b9dba6-79472033
(integer) 1765

This shows how many seconds until the session expires.