Go to the documentation of this file.
47 'compress_threshold' => 1500,
48 'connect_timeout' => 0.5,
53 protected function doGet( $key, $flags = 0, &$casToken =
null ) {
57 public function set( $key,
$value, $exptime = 0, $flags = 0 ) {
62 protected function cas( $casToken, $key,
$value, $exptime = 0, $flags = 0 ) {
67 public function delete( $key, $flags = 0 ) {
71 public function add( $key,
$value, $exptime = 0, $flags = 0 ) {
79 return ( $n !==
false && $n !==
null ) ? $n :
false;
85 return ( $n !==
false && $n !==
null ) ? $n :
false;
88 public function changeTTL( $key, $exptime = 0, $flags = 0 ) {
118 function ( $arg )
use ( &$charsLeft ) {
119 $arg = strtr( $arg,
' ',
'_' );
122 $arg = preg_replace_callback(
123 '/[^\x21-\x22\x24\x26-\x39\x3b-\x7e]+/',
125 return rawurlencode( $m[0] );
131 if ( $charsLeft > 33 && strlen( $arg ) > $charsLeft ) {
132 $arg =
'#' . md5( $arg );
135 $charsLeft -= strlen( $arg );
141 if ( $charsLeft < 0 ) {
142 return $keyspace .
':BagOStuff-long-key:##' . md5( implode(
':',
$args ) );
157 if ( preg_match(
'/[^\x21-\x7e]+/', $key ) ) {
158 throw new Exception(
"Key contains invalid characters: $key" );
173 if ( $expiry > 2592000 && $expiry < 1000000000 ) {
184 $this->logger->debug( $text );
fixExpiry( $expiry)
TTLs higher than 30 days will be detected as absolute TTLs (UNIX timestamps), and will result in the ...
incr( $key, $value=1)
Increase stored value of $key by $value while preserving its TTL.
processing should stop and the error should be shown to the user * false
Base class for memcached clients.
applyDefaultParams( $params)
Fill in some defaults for missing keys in $params.
Class representing a cache/ephemeral data store.
injection txt This is an overview of how MediaWiki makes use of dependency injection The design described here grew from the discussion of RFC T384 The term dependency this means that anything an object needs to operate should be injected from the the object itself should only know narrow no concrete implementation of the logic it relies on The requirement to inject everything typically results in an architecture that based on two main types of and essentially stateless service objects that use other service objects to operate on the value objects As of the beginning MediaWiki is only starting to use the DI approach Much of the code still relies on global state or direct resulting in a highly cyclical dependency which acts as the top level factory for services in MediaWiki which can be used to gain access to default instances of various services MediaWikiServices however also allows new services to be defined and default services to be redefined Services are defined or redefined by providing a callback the instantiator that will return a new instance of the service When it will create an instance of MediaWikiServices and populate it with the services defined in the files listed by thereby bootstrapping the DI framework Per $wgServiceWiringFiles lists includes ServiceWiring php
debugLog( $text)
Send a debug message to the log.
memcached client class implemented using (p)fsockopen()
as see the revision history and available at free of to any person obtaining a copy of this software and associated documentation to deal in the Software without including without limitation the rights to use
changeTTL( $key, $exptime=0, $flags=0)
Change the expiration on a key if it exists.
The wiki should then use memcached to cache various data To use multiple just add more items to the array To increase the weight of a make its entry a array("192.168.0.1:11211", 2))
doGet( $key, $flags=0, &$casToken=null)
cas( $casToken, $key, $value, $exptime=0, $flags=0)
Check and set an item.
decr( $key, $value=1)
Decrease stored value of $key by $value while preserving its TTL.
makeKeyInternal( $keyspace, $args)
Construct a cache key.
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...
__construct(array $params)
$params include:
add( $key, $value, $exptime=0, $flags=0)
Insert an item if it does not already exist.
MemcachedClient Memcached $client