for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
/**
* This file is part of the InMemoryList package.
*
* (c) Mauro Cassani<https://github.com/mauretto78>
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace InMemoryList\Infrastructure\Drivers;
use InMemoryList\Infrastructure\Drivers\Contracts\DriverInterface;
use InMemoryList\Infrastructure\Drivers\Exceptions\ApcuDriverCheckException;
class ApcuDriver implements DriverInterface
{
* ApcuDriver constructor.
* @codeCoverageIgnore
* @throws ApcuDriverCheckException
public function __construct()
if (!$this->check()) {
throw new ApcuDriverCheckException('Apcu extension is not loaded.');
}
$this->connect();
* @return bool
public function check()
if (extension_loaded('apcu') && ini_get('apc.enabled')) {
return true;
return false;
public function clear()
return apcu_clear_cache();
public function connect()
* @return mixed
public function getInstance()
return $this;