refactoring, added uri class.
This commit is contained in:
59
laravel/cache/drivers/apc.php
vendored
59
laravel/cache/drivers/apc.php
vendored
@@ -1,15 +1,52 @@
|
||||
<?php namespace Laravel\Cache\Drivers;
|
||||
|
||||
use Laravel\Proxy;
|
||||
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 proxy class instance.
|
||||
* The APC engine instance.
|
||||
*
|
||||
* @var Proxy
|
||||
* @var APC_Engine
|
||||
*/
|
||||
private $proxy;
|
||||
private $apc;
|
||||
|
||||
/**
|
||||
* The cache key from the cache configuration file.
|
||||
@@ -21,14 +58,14 @@ class APC extends Driver {
|
||||
/**
|
||||
* Create a new APC cache driver instance.
|
||||
*
|
||||
* @param Proxy $proxy
|
||||
* @param string $key
|
||||
* @param APC_Engine $apc
|
||||
* @param string $key
|
||||
* @return void
|
||||
*/
|
||||
public function __construct(Proxy $proxy, $key)
|
||||
public function __construct(APC_Engine $apc, $key)
|
||||
{
|
||||
$this->apc = $apc;
|
||||
$this->key = $key;
|
||||
$this->proxy = $proxy;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -50,7 +87,7 @@ class APC extends Driver {
|
||||
*/
|
||||
protected function retrieve($key)
|
||||
{
|
||||
if ( ! is_null($cache = $this->proxy->apc_fetch($this->key.$key))) return $cache;
|
||||
if ( ! is_null($cache = $this->apc->fetch($this->key.$key))) return $cache;
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -63,7 +100,7 @@ class APC extends Driver {
|
||||
*/
|
||||
public function put($key, $value, $minutes)
|
||||
{
|
||||
$this->proxy->apc_store($this->key.$key, $value, $minutes * 60);
|
||||
$this->apc->store($this->key.$key, $value, $minutes * 60);
|
||||
}
|
||||
|
||||
/**
|
||||
@@ -74,7 +111,7 @@ class APC extends Driver {
|
||||
*/
|
||||
public function forget($key)
|
||||
{
|
||||
$this->proxy->apc_delete($this->key.$key);
|
||||
$this->apc->delete($this->key.$key);
|
||||
}
|
||||
|
||||
}
|
||||
Reference in New Issue
Block a user