Development

/plugins/sfRediskaPlugin/lib/sfRediska.class.php

You must first sign up to be able to contribute.

root/plugins/sfRediskaPlugin/lib/sfRediska.class.php

Revision 29040, 1.0 kB (checked in by ryangrenz, 3 years ago)

merged changes from Ivans updates, plus updated documentation

  • Property svn:executable set to *
Line 
1 <?php
2 /**
3 * sfRediska client class
4 *
5 * @package    sfRediskaPlugin
6 * @subpackage cache
7 * @author     Ryan Grenz <info@ryangrenz.com>
8 * @version    SVN: $Id$
9 */
10 class sfRediska {
11
12   private static $config = null;
13   protected static $instances = array();
14     
15   public static function getInstance($instance='default')
16   {
17       if (!isset(self::$instances[$instance])) {
18           // Needed to make Rediska require paths resolve correctly:
19           set_include_path(get_include_path() . PATH_SEPARATOR . sfConfig::get('sf_plugins_dir').'/sfRediskaPlugin/lib/rediska/library'); 
20           self::$instances[$instance] = new Rediska(self::getConfig($instance));
21       }
22
23       return self::$instances[$instance];
24   }
25  
26   public static function getConfig($instance='default')
27   {
28       $path = "app_rediska_$instance";
29       $config = sfConfig::get($path);
30       if (!$config) throw new sfInitializationException("No Redis config located at '$path' in app.yml");
31       return $config;
32   }     
33
34 }
Note: See TracBrowser for help on using the browser.