コード例 #1
0
ファイル: cache.php プロジェクト: gigikiri/masjid-l3
 /**
  * Create a new cache driver instance.
  *
  * @param  string  $driver
  * @return Cache\Drivers\Driver
  */
 protected static function factory($driver)
 {
     if (isset(static::$registrar[$driver])) {
         $resolver = static::$registrar[$driver];
         return $resolver();
     }
     switch ($driver) {
         case 'apc':
             return new Cache\Drivers\APC(Config::get('cache.key'));
         case 'file':
             return new Cache\Drivers\File(path('storage') . 'cache' . DS);
         case 'memcached':
             return new Cache\Drivers\Memcached(Memcached::connection(), Config::get('cache.key'));
         case 'memory':
             return new Cache\Drivers\Memory();
         case 'redis':
             return new Cache\Drivers\Redis(Redis::db());
         case 'database':
             return new Cache\Drivers\Database(Config::get('cache.key'));
         case 'wincache':
             return new Cache\Drivers\WinCache(Config::get('cache.key'));
         default:
             throw new \Exception("Cache driver {$driver} is not supported.");
     }
 }
コード例 #2
0
 /**
  * Create a new cache driver instance.
  *
  * @param  string  $driver
  * @return Driver
  */
 protected static function factory($driver)
 {
     switch ($driver) {
         case 'apc':
             return new Drivers\APC(Config::get('cache.key'));
         case 'file':
             return new Drivers\File(CACHE_PATH);
         case 'memcached':
             return new Drivers\Memcached(Memcached::instance(), Config::get('cache.key'));
         case 'redis':
             return new Drivers\Redis(Redis::db());
         default:
             throw new \DomainException("Cache driver {$driver} is not supported.");
     }
 }