/** * Create a new session driver instance. * * @param string $driver * @return Session\Drivers\Driver */ public static function factory($driver) { if (isset(static::$registrar[$driver])) { $resolver = static::$registrar[$driver]; return $resolver(); } switch ($driver) { case 'apc': return new Session\Drivers\APC(Cache::driver('apc')); case 'cookie': return new Session\Drivers\Cookie(); case 'database': return new Session\Drivers\Database(Database::connection()); case 'file': return new Session\Drivers\File(path('storage') . 'sessions' . DS); case 'memcached': return new Session\Drivers\Memcached(Cache::driver('memcached')); case 'memory': return new Session\Drivers\Memory(); case 'redis': return new Session\Drivers\Redis(Cache::driver('redis')); default: throw new \Exception("Session driver [{$driver}] is not supported."); } }
/** * Stores the assets in the cache for a set amount of time. * * @param string $assets * @return void */ public function store($assets) { if (!$this->exists()) { C::put($this->name(), $assets, $this->time); } }