- xCache
- WinCache
- Predis
- Redis
- Memcached
- Null (special for instanciate no effect cache driver)
php composer.phar require mactronique/phpcache "~1.0"No configuration need.
No configuration need.
No configuration need.
$config = array(
"host" => "127.0.0.1",
"port" => "",
"password" => "",
"database" => "",
"timeout" => 1,
"read_write_timeout" => 1
);Only host key is required.
$config = array(
"host" => "127.0.0.1",
"port" => "",
"password" => "",
"database" => "",
"timeout" => 1
);Only host key is required.
$config = array(
"host" => "127.0.0.1",
"port" => 11211,
"sharing" => 100
);Only host key is required.
This code is example of service class
useMactronique\PhpCache\Service\PhpCache;
useMactronique\PhpCache\Driver\NullDriver;
class myService
{
private$cache
public function__construct(PhpCache$cache = null)
{
if (null === $cache) {
$cache = newPhpCache();
$cache->registerDriver(newNullDriver());
}
$this->cache = $cache;
}
publicfunctionmyAction()
{
/* You can use the cache but never key exist and all get return null. */$val = $this->cache->get('key');
[...]
}
}