diff --git a/laravel/cache/drivers/apc.php b/laravel/cache/drivers/apc.php index 25d6bb5d..f2200f1d 100644 --- a/laravel/cache/drivers/apc.php +++ b/laravel/cache/drivers/apc.php @@ -7,7 +7,7 @@ class APC extends Driver { * * @var string */ - private $key; + protected $key; /** * Create a new APC cache driver instance. @@ -45,6 +45,11 @@ protected function retrieve($key) /** * Write an item to the cache for a given number of minutes. * + * + * // Put an item in the cache for 15 minutes + * Cache::put('name', 'Taylor', 15); + * + * * @param string $key * @param mixed $value * @param int $minutes diff --git a/laravel/cache/drivers/file.php b/laravel/cache/drivers/file.php index eb2b4ecb..f1431d09 100644 --- a/laravel/cache/drivers/file.php +++ b/laravel/cache/drivers/file.php @@ -1,4 +1,4 @@ -path.$key)) return null; + if ( ! \Laravel\File::exists($this->path.$key)) return null; - if (time() >= substr($cache = F::get($this->path.$key), 0, 10)) + if (time() >= substr($cache = \Laravel\File::get($this->path.$key), 0, 10)) { return $this->forget($key); } @@ -52,6 +52,11 @@ protected function retrieve($key) /** * Write an item to the cache for a given number of minutes. * + * + * // Put an item in the cache for 15 minutes + * Cache::put('name', 'Taylor', 15); + * + * * @param string $key * @param mixed $value * @param int $minutes @@ -59,7 +64,7 @@ protected function retrieve($key) */ public function put($key, $value, $minutes) { - F::put($this->path.$key, (time() + ($minutes * 60)).serialize($value)); + \Laravel\File::put($this->path.$key, (time() + ($minutes * 60)).serialize($value)); } /** @@ -70,7 +75,7 @@ public function put($key, $value, $minutes) */ public function forget($key) { - F::delete($this->path.$key); + \Laravel\File::delete($this->path.$key); } } \ No newline at end of file diff --git a/laravel/cache/drivers/memcached.php b/laravel/cache/drivers/memcached.php index b76b749d..81172154 100644 --- a/laravel/cache/drivers/memcached.php +++ b/laravel/cache/drivers/memcached.php @@ -7,14 +7,14 @@ class Memcached extends Driver { * * @var Memcache */ - private $memcache; + protected $memcache; /** * The cache key from the cache configuration file. * * @var string */ - private $key; + protected $key; /** * Create a new Memcached cache driver instance. @@ -53,6 +53,11 @@ protected function retrieve($key) /** * Write an item to the cache for a given number of minutes. * + * + * // Put an item in the cache for 15 minutes + * Cache::put('name', 'Taylor', 15); + * + * * @param string $key * @param mixed $value * @param int $minutes diff --git a/laravel/cache/manager.php b/laravel/cache/manager.php index 229f0427..f6302f53 100644 --- a/laravel/cache/manager.php +++ b/laravel/cache/manager.php @@ -1,6 +1,4 @@ -driver->load($this->transporter->get($config)); - // If the session is expired, a new session will be generated and all of the data from - // the previous session will be lost. The new session will be assigned a random, long - // string ID to uniquely identify it among the application's current users. + // If the session is expired, a new session will be generated and all of + // the data from the previous session will be lost. The new session will + // be assigned a random, long string ID to uniquely identify it among + // the application's current users. if (is_null($session) or (time() - $session['last_activity']) > ($config['lifetime'] * 60)) { $this->exists = false; @@ -70,10 +71,11 @@ public function payload($config) $payload = new Payload($session); - // If a CSRF token is not present in the session, we will generate one. These tokens - // are generated per session to protect against Cross-Site Request Forgery attacks on - // the application. It is up to the developer to take advantage of them using the token - // methods on the Form class and the "csrf" route filter. + // If a CSRF token is not present in the session, we will generate one. + // These tokens are generated per session to protect against Cross-Site + // Request Forgery attacks on the application. It is up to the developer + // to take advantage of them using the token methods on the Form class + // and the "csrf" route filter. if ( ! $payload->has('csrf_token')) { $payload->put('csrf_token', Str::random(16)); @@ -92,8 +94,9 @@ public function payload($config) */ public function close(Payload $payload, $config, $flash = array()) { - // If the session ID has been regenerated, we will need to inform the session driver - // that the session will need to be persisted to the data store as a new session. + // If the session ID has been regenerated, we will need to inform the + // session driver that the session will need to be persisted to the + // data store as a new session. if ($payload->regenerated) $this->exists = false; foreach ($flash as $key => $value) @@ -105,9 +108,10 @@ public function close(Payload $payload, $config, $flash = array()) $this->transporter->put($payload->session['id'], $config); - // Some session drivers implement the Sweeper interface, which specified that the driver - // must do its garbage collection manually. Alternatively, some drivers such as APC and - // Memcached are not required to manually clean up their sessions. + // Some session drivers may implement the Sweeper interface, meaning the + // driver must do its garbage collection manually. Alternatively, some + // drivers such as APC and Memcached are not required to manually + // clean up their sessions. if (mt_rand(1, $config['sweepage'][1]) <= $config['sweepage'][0] and $this->driver instanceof Drivers\Sweeper) { $this->driver->sweep(time() - ($config['lifetime'] * 60)); diff --git a/laravel/session/payload.php b/laravel/session/payload.php index 63c39cb2..780d26b3 100644 --- a/laravel/session/payload.php +++ b/laravel/session/payload.php @@ -1,7 +1,4 @@ -readdress(':old:', ':new:', array_keys($this->session['data'])); + $this->replace(':old:', ':new:', array_keys($this->session['data'])); } /** @@ -197,7 +194,7 @@ public function age() if (strpos($key, ':old:') === 0) $this->forget($key); } - $this->readdress(':new:', ':old:', array_keys($this->session['data'])); + $this->replace(':new:', ':old:', array_keys($this->session['data'])); return $this->session; } @@ -210,7 +207,7 @@ public function age() * @param array $keys * @return void */ - private function readdress($search, $replace, $keys) + private function replace($search, $replace, $keys) { $this->session['data'] = array_combine(str_replace($search, $replace, $keys), array_values($this->session['data'])); }