* @return bool
* @throws MWException
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
// APC's CAS functions only work on integers
throw new MWException( "CAS is not implemented in " . __CLASS__ );
}
*/
abstract public function set( $key, $value, $exptime = 0 );
- /**
- * Check and set an item.
- * @param mixed $casToken
- * @param string $key
- * @param mixed $value
- * @param int $exptime Either an interval in seconds or a unix timestamp for expiry
- * @return bool Success
- */
- abstract public function cas( $casToken, $key, $value, $exptime = 0 );
-
/**
* Delete an item.
* @param string $key
return $success;
}
+ /**
+ * Check and set an item.
+ * @param mixed $casToken
+ * @param string $key
+ * @param mixed $value
+ * @param int $exptime Either an interval in seconds or a unix timestamp for expiry
+ * @return bool Success
+ */
+ abstract protected function cas( $casToken, $key, $value, $exptime = 0 );
+
/**
* @see BagOStuff::merge()
*
* @param mixed $casToken [optional]
* @return bool
*/
- function get( $key, &$casToken = null ) {
+ public function get( $key, &$casToken = null ) {
return false;
}
* @param int $exp
* @return bool
*/
- function set( $key, $value, $exp = 0 ) {
+ public function set( $key, $value, $exp = 0 ) {
return true;
}
* @param int $exp
* @return bool
*/
- function cas( $casToken, $key, $value, $exp = 0 ) {
+ protected function cas( $casToken, $key, $value, $exp = 0 ) {
return true;
}
* @param string $key
* @return bool
*/
- function delete( $key ) {
+ public function delete( $key ) {
return true;
}
* @param mixed $casToken [optional]
* @return bool|mixed
*/
- function get( $key, &$casToken = null ) {
+ public function get( $key, &$casToken = null ) {
if ( !isset( $this->bag[$key] ) ) {
return false;
}
* @param int $exptime
* @return bool
*/
- function set( $key, $value, $exptime = 0 ) {
+ public function set( $key, $value, $exptime = 0 ) {
$this->bag[$key] = array( $value, $this->convertExpiry( $exptime ) );
return true;
}
* @param int $exptime
* @return bool
*/
- function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
if ( $this->get( $key ) === $casToken ) {
return $this->set( $key, $value, $exptime );
}
* @param int $exptime
* @return bool
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
return $this->client->cas( $casToken, $this->encodeKey( $key ),
$value, $this->fixExpiry( $exptime ) );
}
* @param int $exptime
* @return bool
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
$this->debugLog( "cas($key)" );
return $this->checkResult( $key, parent::cas( $casToken, $key, $value, $exptime ) );
}
* @return bool
* @throws MWException
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
throw new MWException( "CAS is not implemented in " . __CLASS__ );
}
return $result;
}
- public function cas( $casToken, $key, $value, $expiry = 0 ) {
+ protected function cas( $casToken, $key, $value, $expiry = 0 ) {
list( $server, $conn ) = $this->getConnection( $key );
if ( !$conn ) {
* @param int $exptime
* @return bool
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
list( $serverIndex, $tableName ) = $this->getTableByKey( $key );
try {
$db = $this->getDB( $serverIndex );
* @param int $exptime Expiration time
* @return bool
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
return wincache_ucache_cas( $key, $casToken, serialize( $value ) );
}
* @return bool
* @throws MWException
*/
- public function cas( $casToken, $key, $value, $exptime = 0 ) {
+ protected function cas( $casToken, $key, $value, $exptime = 0 ) {
// Can't find any documentation on xcache cas
throw new MWException( "CAS is not implemented in " . __CLASS__ );
}