MediaWiki  REL1_22
MemcachedPhpBagOStuff.php
Go to the documentation of this file.
00001 <?php
00029 class MemcachedPhpBagOStuff extends MemcachedBagOStuff {
00030 
00044     function __construct( $params ) {
00045         $params = $this->applyDefaultParams( $params );
00046 
00047         $this->client = new MemCachedClientforWiki( $params );
00048         $this->client->set_servers( $params['servers'] );
00049         $this->client->set_debug( $params['debug'] );
00050     }
00051 
00055     public function setDebug( $debug ) {
00056         $this->client->set_debug( $debug );
00057     }
00058 
00063     public function getMulti( array $keys ) {
00064         $callback = array( $this, 'encodeKey' );
00065         return $this->client->get_multi( array_map( $callback, $keys ) );
00066     }
00067 
00073     public function lock( $key, $timeout = 0 ) {
00074         return $this->client->lock( $this->encodeKey( $key ), $timeout );
00075     }
00076 
00081     public function unlock( $key ) {
00082         return $this->client->unlock( $this->encodeKey( $key ) );
00083     }
00084 
00090     public function incr( $key, $value = 1 ) {
00091         return $this->client->incr( $this->encodeKey( $key ), $value );
00092     }
00093 
00099     public function decr( $key, $value = 1 ) {
00100         return $this->client->decr( $this->encodeKey( $key ), $value );
00101     }
00102 }