Rediska

Follow me on twitter…

Usage

Rediska Commands

You may use sfRediskaPlugin to directly use any Rediska instance.
These are only instantiated once per page load for efficiency.

Heres an example:

<?php

$rediska = sfRediska::getInstance('otherstuff');
$rediska->pipeline()
        ->addToSortedSet(...)
        ->deleteFromSortedSet(..)
        ->delete(..)
        ->execute();

?>

As you can see all the Rediska commands are fully accessible this way.

Doctrine Redis driver

You can use this connection to query/result cache a Doctrine query. For example, heres what I do in my Doctrine Test table class:

<?php

public static function getById($id)
{
    $table = Doctrine_Core::getTable('Test');
    return $table->createQuery('t')
		 ->where('t.id = ?', $id)
		 ->useResultCache(true, 86400, "test_$id")
		 ->fetchOne();    
}

?>

Comments

Fork me on GitHub