add support for memcached flush_all command

This commit is contained in:
Stijn Van der Borght
2019-02-15 16:31:42 +00:00
parent 302447eade
commit 1d23a840b3

View File

@@ -529,6 +529,29 @@ class Memcached
return $newVal; return $newVal;
} }
/**
* Flush the cache
*
* @return boolean
*/
public function flush()
{
$this->writeSocket('flush_all') ;
$s = $this->readSocket();
if ('OK' == $s) {
$this->resultCode = Memcached::RES_SUCCESS;
$this->resultMessage = '';
return true;
} else {
$this->resultCode = Memcached::RES_FAILURE;
$this->resultMessage = 'Flush fail.';
return false;
}
}
/** /**
* Write data to socket * Write data to socket
* *