/**
* Available parameters are:
* - servers: The list of IP:port combinations holding the memcached servers.
- * - debug: Whether to set the debug flag in the underlying client.
* - persistent: Whether to use a persistent connection
* - compress_threshold: The minimum size an object must be before it is compressed
* - timeout: The read timeout in microseconds
*/
function __construct( $params ) {
parent::__construct( $params );
- $params = $this->applyDefaultParams( $params );
+
+ // Default class-specific parameters
+ $params += [
+ 'compress_threshold' => 1500,
+ 'connect_timeout' => 0.5
+ ];
$this->client = new MemcachedClient( $params );
$this->client->set_servers( $params['servers'] );
- $this->client->set_debug( $params['debug'] );
}
- public function setDebug( $debug ) {
- $this->client->set_debug( $debug );
+ public function setDebug( $enabled ) {
+ parent::debug( $enabled );
+ $this->client->set_debug( $enabled );
}
protected function doGet( $key, $flags = 0, &$casToken = null ) {
return ( $n !== false && $n !== null ) ? $n : false;
}
- public function changeTTL( $key, $exptime = 0, $flags = 0 ) {
+ protected function doChangeTTL( $key, $exptime, $flags ) {
return $this->client->touch(
$this->validateKeyEncoding( $key ),
$this->fixExpiry( $exptime )
);
}
- public function doGetMulti( array $keys, $flags = 0 ) {
+ protected function doGetMulti( array $keys, $flags = 0 ) {
foreach ( $keys as $key ) {
$this->validateKeyEncoding( $key );
}