From cc625e24c277871ac817b5821768bb595c73220a Mon Sep 17 00:00:00 2001 From: Taylor Otwell Date: Wed, 28 Sep 2011 22:51:07 -0500 Subject: [PATCH] cleaning up the cache class. --- laravel/cache/manager.php | 18 +++++++++++++++++- 1 file changed, 17 insertions(+), 1 deletion(-) diff --git a/laravel/cache/manager.php b/laravel/cache/manager.php index d23e3c73..229f0427 100644 --- a/laravel/cache/manager.php +++ b/laravel/cache/manager.php @@ -17,6 +17,14 @@ class Manager { * If no driver name is specified, the default cache driver will be returned * as defined in the cache configuration file. * + * + * // Get the default cache driver instance + * $driver = Cache::driver(); + * + * // Get a specific cache driver instance by name + * $driver = Cache::driver('memcached'); + * + * * @param string $driver * @return Cache\Driver */ @@ -31,7 +39,7 @@ public static function driver($driver = null) throw new \Exception("Cache driver [$driver] is not supported."); } - return static::$drivers[$driver] = IoC::container()->resolve('laravel.cache.'.$driver); + return static::$drivers[$driver] = IoC::container()->core('cache.'.$driver); } return static::$drivers[$driver]; @@ -42,6 +50,14 @@ public static function driver($driver = null) * * Passing method calls to the driver instance provides a convenient API for the developer * when always using the default cache driver. + * + * + * // Call the "get" method on the default driver + * $name = Cache::get('name'); + * + * // Call the "put" method on the default driver + * Cache::put('name', 'Taylor', 15); + * */ public static function __callStatic($method, $parameters) {