for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* APCu store.
*
* @package SugiPHP.Cache
* @author Plamen Popov <[email protected]>
* @license http://opensource.org/licenses/mit-license.php (MIT License)
*/
namespace SugiPHP\Cache;
class ApcuStore implements StoreInterface, IncrementorInterface
{
* {@inheritdoc}
public function add($key, $value, $ttl = 0)
$res = apcu_add($key, $value, $ttl);
return $res;
}
public function set($key, $value, $ttl = 0)
$res = apcu_store($key, $value, $ttl);
public function get($key)
$success = null;
$result = apcu_fetch($key, $success);
if (!$success) {
return null;
return $result;
public function has($key)
if (!apcu_exists($key)) {
return false;
return true;
public function delete($key)
apcu_delete($key);
public function flush()
apcu_clear_cache();
public function inc($key, $step = 1)
return apcu_inc($key, $step);
public function dec($key, $step = 1)
return apcu_dec($key, $step);