Rediska

Follow me on twitter…

Zend_Cache backend

Redis is a nice solution for caching your data.

Rediska provides Redis adapter for Zend_Cache:

<?php

// About initialize and working with Zend_Cache
// read offical Zend_Cache manual:
// http://framework.zend.com/manual/en/zend.cache.html

// Core frontend options
$frontendOptions = array(
    'cache_id_prefix' => 'Application_'
);
// Rediska options
$backendOptions = array(
    'servers' => array(
        array('host' => '127.0.0.1', 'port' => 6379)
    )
);

$cache = Zend_Cache::factory(
    'Core',
    'Rediska_Zend_Cache_Backend_Redis',
    $frontendOptions,
    $backendOptions,
    false,
    true
);

$data = array(1, 2, 3);
$cache->save($data, 'data');

?>

Comments