|
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 |
|
|---|
| 4 |
|
|---|
| 5 |
|
|---|
| 6 |
|
|---|
| 7 |
|
|---|
| 8 |
|
|---|
| 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 |
|
|---|
| 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 |
} |
|---|