47 'compress_threshold' => 1500,
48 'connect_timeout' => 0.5,
53 protected function doGet( $key, $flags = 0 ) {
63 public function set( $key,
$value, $exptime = 0, $flags = 0 ) {
68 protected function cas( $casToken, $key,
$value, $exptime = 0 ) {
73 public function delete( $key ) {
82 public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
83 return $this->
mergeViaCas( $key, $callback, $exptime, $attempts );
116 function ( $arg ) use ( &$charsLeft ) {
117 $arg = strtr( $arg,
' ',
'_' );
120 $arg = preg_replace_callback(
121 '/[^\x21-\x22\x24\x26-\x39\x3b-\x7e]+/',
123 return rawurlencode( $m[0] );
129 if ( $charsLeft > 33 && strlen( $arg ) > $charsLeft ) {
130 $arg =
'#' . md5( $arg );
133 $charsLeft -= strlen( $arg );
139 if ( $charsLeft < 0 ) {
140 return $keyspace .
':BagOStuff-long-key:##' . md5( implode(
':',
$args ) );
155 if ( preg_match(
'/[^\x21-\x7e]+/', $key ) ) {
156 throw new Exception(
"Key contains invalid characters: $key" );
171 if ( $expiry > 2592000 && $expiry < 1000000000 ) {
182 $this->logger->debug( $text );
186 if ( array_key_exists(
'val', $event ) ) {
interface is intended to be more or less compatible with the PHP memcached client.
mergeViaCas( $key, $callback, $exptime=0, $attempts=10)
Base class for memcached clients.
makeKeyInternal( $keyspace, $args)
Construct a cache key.
modifySimpleRelayEvent(array $event)
Modify a cache update operation array for EventRelayer::notify()
getClient()
Get the underlying client object.
validateKeyEncoding( $key)
Ensure that a key is safe to use (contains no control characters and no characters above the ASCII ra...
MemcachedClient Memcached $client
getWithToken( $key, &$casToken, $flags=0)
debugLog( $text)
Send a debug message to the log.
applyDefaultParams( $params)
Fill in some defaults for missing keys in $params.
add( $key, $value, $exptime=0)
__construct(array $params)
$params include:
changeTTL( $key, $exptime=0)
Reset the TTL on a key if it exists.
fixExpiry( $expiry)
TTLs higher than 30 days will be detected as absolute TTLs (UNIX timestamps), and will result in the ...
merge( $key, callable $callback, $exptime=0, $attempts=10, $flags=0)
Merge changes into the existing cache value (possibly creating a new one)
cas( $casToken, $key, $value, $exptime=0)
Check and set an item.
memcached client class implemented using (p)fsockopen()
The phpstorm stubs package includes the Memcached class with two parameters and docs saying that they...
processing should stop and the error should be shown to the user * false