revert back to more sensible architecture.
This commit is contained in:
58
laravel/cache/drivers/apc.php
vendored
58
laravel/cache/drivers/apc.php
vendored
@@ -1,53 +1,7 @@
|
||||
<?php namespace Laravel\Cache\Drivers;
|
||||
|
||||
class APC_Engine {
|
||||
|
||||
/**
|
||||
* Retrieve an item from the APC cache.
|
||||
*
|
||||
* @param string $key
|
||||
* @return mixed
|
||||
*/
|
||||
public function fetch($key)
|
||||
{
|
||||
return apc_fetch($key);
|
||||
}
|
||||
|
||||
/**
|
||||
* Store an item in the APC cache.
|
||||
*
|
||||
* @param string $key
|
||||
* @param mixed $value
|
||||
* @param int $seconds
|
||||
* @return void
|
||||
*/
|
||||
public function store($key, $value, $seconds)
|
||||
{
|
||||
apc_store($key, $value, $seconds);
|
||||
}
|
||||
|
||||
/**
|
||||
* Delete an item from the APC cache.
|
||||
*
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function delete($key)
|
||||
{
|
||||
apc_delete($key);
|
||||
}
|
||||
|
||||
}
|
||||
|
||||
class APC extends Driver {
|
||||
|
||||
/**
|
||||
* The APC engine instance.
|
||||
*
|
||||
* @var APC_Engine
|
||||
*/
|
||||
private $apc;
|
||||
|
||||
/**
|
||||
* The cache key from the cache configuration file.
|
||||
*
|
||||
@@ -58,13 +12,11 @@ class APC extends Driver {
|
||||
/**
|
||||
* Create a new APC cache driver instance.
|
||||
*
|
||||
* @param APC_Engine $apc
|
||||
* @param string $key
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(APC_Engine $apc, $key)
|
||||
public function __construct($key)
|
||||
{
|
||||
$this->apc = $apc;
|
||||
$this->key = $key;
|
||||
}
|
||||
|
||||
@@ -87,7 +39,7 @@ class APC extends Driver {
|
||||
*/
|
||||
protected function retrieve($key)
|
||||
{
|
||||
if ( ! is_null($cache = $this->apc->fetch($this->key.$key))) return $cache;
|
||||
if ( ! is_null($cache = apc_fetch($this->key.$key))) return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -100,7 +52,7 @@ class APC extends Driver {
|
||||
*/
|
||||
public function put($key, $value, $minutes)
|
||||
{
|
||||
$this->apc->store($this->key.$key, $value, $minutes * 60);
|
||||
apc_store($this->key.$key, $value, $minutes * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -111,7 +63,7 @@ class APC extends Driver {
|
||||
*/
|
||||
public function forget($key)
|
||||
{
|
||||
$this->apc->delete($this->key.$key);
|
||||
apc_delete($this->key.$key);
|
||||
}
|
||||
|
||||
}
|
||||
23
laravel/cache/drivers/file.php
vendored
23
laravel/cache/drivers/file.php
vendored
@@ -1,13 +1,8 @@
|
||||
<?php namespace Laravel\Cache\Drivers;
|
||||
|
||||
class File extends Driver {
|
||||
use Laravel\File as F;
|
||||
|
||||
/**
|
||||
* The file engine instance.
|
||||
*
|
||||
* @var Laravel\File
|
||||
*/
|
||||
private $file;
|
||||
class File extends Driver {
|
||||
|
||||
/**
|
||||
* The path to which the cache files should be written.
|
||||
@@ -19,13 +14,11 @@ class File extends Driver {
|
||||
/**
|
||||
* Create a new File cache driver instance.
|
||||
*
|
||||
* @param Laravel\File $file
|
||||
* @param string $path
|
||||
* @param string $path
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(\Laravel\File $file, $path)
|
||||
public function __construct($path)
|
||||
{
|
||||
$this->file = $file;
|
||||
$this->path = $path;
|
||||
}
|
||||
|
||||
@@ -48,9 +41,9 @@ class File extends Driver {
|
||||
*/
|
||||
protected function retrieve($key)
|
||||
{
|
||||
if ( ! $this->file->exists($this->path.$key)) return null;
|
||||
if ( ! F::exists($this->path.$key)) return null;
|
||||
|
||||
if (time() >= substr($cache = $this->file->get($this->path.$key), 0, 10))
|
||||
if (time() >= substr($cache = F::get($this->path.$key), 0, 10))
|
||||
{
|
||||
return $this->forget($key);
|
||||
}
|
||||
@@ -68,7 +61,7 @@ class File extends Driver {
|
||||
*/
|
||||
public function put($key, $value, $minutes)
|
||||
{
|
||||
$this->file->put($this->path.$key, (time() + ($minutes * 60)).serialize($value));
|
||||
F::put($this->path.$key, (time() + ($minutes * 60)).serialize($value));
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -79,7 +72,7 @@ class File extends Driver {
|
||||
*/
|
||||
public function forget($key)
|
||||
{
|
||||
$this->file->delete($this->path.$key);
|
||||
F::delete($this->path.$key);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user