Merge pull request #65 from stijnvdb88/master

add support for memcached flush_all command
This commit is contained in:
Leo Khoa
2019-02-16 10:30:44 +07:00
committed by GitHub

View File

@@ -529,6 +529,29 @@ class Memcached
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
*