[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/objectcache/ -> RedisBagOStuff.php (summary)

(no description)

File Size: 401 lines (12 kb)
Included or required:0 times
Referenced: 0 times
Includes or requires: 0 files

Defines 1 class

RedisBagOStuff:: (15 methods):
  __construct()
  get()
  set()
  cas()
  delete()
  getMulti()
  setMulti()
  add()
  incr()
  serialize()
  unserialize()
  getConnection()
  logError()
  handleException()
  logRequest()


Class: RedisBagOStuff  - X-Ref

Object caching using Redis (http://redis.io/).

This program is free software; you can redistribute it and/or modify
it under the terms of the GNU General Public License as published by
the Free Software Foundation; either version 2 of the License, or
(at your option) any later version.

This program is distributed in the hope that it will be useful,
but WITHOUT ANY WARRANTY; without even the implied warranty of
MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
GNU General Public License for more details.

You should have received a copy of the GNU General Public License along
with this program; if not, write to the Free Software Foundation, Inc.,
51 Franklin Street, Fifth Floor, Boston, MA 02110-1301, USA.
http://www.gnu.org/copyleft/gpl.html

__construct( $params )   X-Ref
Construct a RedisBagOStuff object. Parameters are:

- servers: An array of server names. A server name may be a hostname,
a hostname/port combination or the absolute path of a UNIX socket.
If a hostname is specified but no port, the standard port number
6379 will be used. Required.

- connectTimeout: The timeout for new connections, in seconds. Optional,
default is 1 second.

- persistent: Set this to true to allow connections to persist across
multiple web requests. False by default.

- password: The authentication password, will be sent to Redis in
clear text. Optional, if it is unspecified, no AUTH command will be
sent.

- automaticFailover: If this is false, then each key will be mapped to
a single server, and if that server is down, any requests for that key
will fail. If this is true, a connection failure will cause the client
to immediately try the next server in the list (as determined by a
consistent hashing algorithm). True by default. This has the
potential to create consistency issues if a server is slow enough to
flap, for example if it is in swap death.
param: array $params

get( $key, &$casToken = null )   X-Ref
No description

set( $key, $value, $expiry = 0 )   X-Ref
No description

cas( $casToken, $key, $value, $expiry = 0 )   X-Ref
No description

delete( $key, $time = 0 )   X-Ref
No description

getMulti( array $keys )   X-Ref
No description

setMulti( array $data, $expiry = 0 )   X-Ref

param: array $data
param: int $expiry
return: bool

add( $key, $value, $expiry = 0 )   X-Ref
No description

incr( $key, $value = 1 )   X-Ref
Non-atomic implementation of incr().

Probably all callers actually want incr() to atomically initialise
values to zero if they don't exist, as provided by the Redis INCR
command. But we are constrained by the memcached-like interface to
return null in that case. Once the key exists, further increments are
atomic.
param: string $key Key to increase
param: int $value Value to add to $key (Default 1)
return: int|bool New value or false on failure

serialize( $data )   X-Ref

param: mixed $data
return: string

unserialize( $data )   X-Ref

param: string $data
return: mixed

getConnection( $key )   X-Ref
Get a Redis object with a connection suitable for fetching the specified key

param: string $key
return: array (server, RedisConnRef) or (false, false)

logError( $msg )   X-Ref
Log a fatal error

param: string $msg

handleException( RedisConnRef $conn, $e )   X-Ref
The redis extension throws an exception in response to various read, write
and protocol errors. Sometimes it also closes the connection, sometimes
not. The safest response for us is to explicitly destroy the connection
object and let it be reopened during the next request.

param: RedisConnRef $conn
param: Exception $e

logRequest( $method, $key, $server, $result )   X-Ref
Send information about a single request to the debug log

param: string $method
param: string $key
param: string $server
param: bool $result



Generated: Fri Nov 28 14:03:12 2014 Cross-referenced by PHPXref 0.7.1