system/libraries/Cache.php 1 location
|
@@ 33-41 (lines=9) @@
|
30 |
|
* @param string configuration |
31 |
|
* @return Cache_Core |
32 |
|
*/ |
33 |
|
public static function & instance($config = false) |
34 |
|
{ |
35 |
|
if (! isset(Cache::$instances[$config])) { |
36 |
|
// Create a new instance |
37 |
|
Cache::$instances[$config] = new Cache($config); |
38 |
|
} |
39 |
|
|
40 |
|
return Cache::$instances[$config]; |
41 |
|
} |
42 |
|
|
43 |
|
/** |
44 |
|
* Loads the configured driver and validates it. |
system/libraries/Database.php 1 location
|
@@ 61-69 (lines=9) @@
|
58 |
|
* @param mixed configuration array or DSN |
59 |
|
* @return Database_Core |
60 |
|
*/ |
61 |
|
public static function & instance($name = 'default', $config = null) |
62 |
|
{ |
63 |
|
if (! isset(Database::$instances[$name])) { |
64 |
|
// Create a new instance |
65 |
|
Database::$instances[$name] = new Database($config === null ? $name : $config); |
66 |
|
} |
67 |
|
|
68 |
|
return Database::$instances[$name]; |
69 |
|
} |
70 |
|
|
71 |
|
/** |
72 |
|
* Returns the name of a given database instance. |