for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php /** MicroArrayCache */
namespace Micro\Cache\Drivers;
use Micro\File\Type;
/**
* Class ArrayDriver
*
* @author Oleg Lunegov <[email protected]>
* @link https://github.com/linpax/microphp-framework
* @copyright Copyright (c) 2013 Oleg Lunegov
* @license https://github.com/linpax/microphp-framework/blob/master/LICENSE
* @package Micro
* @subpackage Cache\Driver
* @version 1.0
* @since 1.0
*/
class ArrayDriver extends CacheDriver
{
/** @var array $driver array as driver */
protected $driver = [];
* @inheritdoc
public function check()
return true;
}
public function get($name)
return !empty($this->driver[$name]) ? $this->driver[$name] : false;
public function set($name, $value)
$this->driver[$name] = $value;
* 2@inheritdoc
public function delete($name)
if (!empty($this->driver[$name])) {
unset($this->driver[$name]);
public function clean()
$this->driver = [];
public function info()
return count($this->driver);
public function getMeta($id)
if (!empty($this->driver[$id])) {
return Type::getType($this->driver[$id]);
return false;
public function increment($name, $offset = 1)
$this->driver[$name] += $offset;
public function decrement($name, $offset = 1)
$this->driver[$name] -= $offset;