for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace Ds\Cache;
/**
* Class MemcacheStorage
* @package Ds\Cache
*/
class MemcacheStorage implements CacheStorageInterface
{
private $mmc;
public function __construct(\Memcached $memcache, $server = 'localhost', $port = 11211)
$this->mmc = $memcache;
$this->mmc->addServer($server, $port);
}
* Add new server to Memcache pool.
* @param $server
* @param $port
public function addServer($server, $port)
* @param string $key
* @return bool
public function has($key){
if (!empty($this->mmc->get($key))){
return true;
return false;
* @param int $delay
public function flush($delay = 0)
$this->mmc->flush($delay);
* @param mixed $value
* @param int $expires
* @return void
public function set($key, $value, $expires)
$this->mmc->set($key, $value, $expires);
* @return mixed
public function get($key)
return $this->mmc->get($key);
public function delete($key)
$this->mmc->delete($key);