Skip to content

Instantly share code, notes, and snippets.

@drewgillson
Created December 25, 2011 00:12
Show Gist options
  • Save drewgillson/1518544 to your computer and use it in GitHub Desktop.
Save drewgillson/1518544 to your computer and use it in GitHub Desktop.
Redis for Tinybrick Lightspeed
case 'redis':
try {
require_once('lib/Credis/Client.php');
require_once('lib/Zend/Cache/Backend.php');
require_once('lib/Zend/Cache/Backend/Interface.php');
require_once('lib/Zend/Cache/Backend/ExtendedInterface.php');
require_once('app/code/core/Zend/Cache/Backend/Redis.php');
self::$cacheEngine = 'redis';
$options = array();
foreach($child2->backend_options as $el){
$options['server'] = (string)$el->server;
$options['port'] = (int)$el->port;
$options['database'] = (int)$el->database;
$options['timeout'] = (int)$el->timeout;
$options['force_standalone'] = (int)$el->force_standalone;
$options['automatic_cleaning_factor'] = (int)$el->automatic_cleaning_factor;
}
self::$cacheData['server'] = new Zend_Cache_Backend_Redis($options);
}
catch (Exception $e) {
die('Redis can not be used as the backend for Lightspeed. Check local.xml for proper configuration.');
}
break;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment