MediaWiki master
Wikimedia\ObjectCache\RedisConnRef Class Reference

Wrapper class for Redis connections that automatically reuses connections (via RAII pattern) More...

Inherits LoggerAwareInterface.

Collaboration diagram for Wikimedia\ObjectCache\RedisConnRef:

Public Member Functions

 __call ( $name, $arguments)
 Magic __call handler for most Redis functions.
 
 __construct (RedisConnectionPool $pool, $server, Redis $conn, LoggerInterface $logger)
 
 __destruct ()
 
 clearLastError ()
 
 getLastError ()
 
 getServer ()
 
 hScan ( $key, &$iterator, $pattern=null, $count=null)
 Hash Scan Handle this explicitly due to needing the iterator passed by reference.
 
 isConnIdentical (Redis $conn)
 
 luaEval ( $script, array $params, $numKeys)
 
 scan (&$iterator, $pattern=null, $count=null)
 Key Scan Handle this explicitly due to needing the iterator passed by reference.
 
 setLogger (LoggerInterface $logger)
 
 sScan ( $key, &$iterator, $pattern=null, $count=null)
 Set Scan Handle this explicitly due to needing the iterator passed by reference.
 
 zScan ( $key, &$iterator, $pattern=null, $count=null)
 Sorted Set Scan Handle this explicitly due to needing the iterator passed by reference.
 

Protected Attributes

Redis $conn
 
string null $lastError
 
LoggerInterface $logger
 
RedisConnectionPool $pool
 
string $server
 

Detailed Description

Wrapper class for Redis connections that automatically reuses connections (via RAII pattern)

This class proxies a Redis class instance from the php-redis PECL extension. All its methods can be called the same way.

See also
https://github.com/phpredis/phpredis#table-of-contents
Since
1.21

Definition at line 39 of file RedisConnRef.php.

Constructor & Destructor Documentation

◆ __construct()

Wikimedia\ObjectCache\RedisConnRef::__construct ( RedisConnectionPool $pool,
$server,
Redis $conn,
LoggerInterface $logger )
Parameters
RedisConnectionPool$pool
string$server
Redis$conn
LoggerInterface$logger

Definition at line 75 of file RedisConnRef.php.

References Wikimedia\ObjectCache\RedisConnRef\$conn, Wikimedia\ObjectCache\RedisConnRef\$logger, Wikimedia\ObjectCache\RedisConnRef\$pool, and Wikimedia\ObjectCache\RedisConnRef\$server.

◆ __destruct()

Wikimedia\ObjectCache\RedisConnRef::__destruct ( )

Definition at line 308 of file RedisConnRef.php.

Member Function Documentation

◆ __call()

Wikimedia\ObjectCache\RedisConnRef::__call ( $name,
$arguments )

Magic __call handler for most Redis functions.

Parameters
string$name
array$arguments
Returns
mixed
Exceptions
RedisException

Definition at line 112 of file RedisConnRef.php.

◆ clearLastError()

Wikimedia\ObjectCache\RedisConnRef::clearLastError ( )

Definition at line 100 of file RedisConnRef.php.

◆ getLastError()

Wikimedia\ObjectCache\RedisConnRef::getLastError ( )

Definition at line 96 of file RedisConnRef.php.

References Wikimedia\ObjectCache\RedisConnRef\$lastError.

◆ getServer()

Wikimedia\ObjectCache\RedisConnRef::getServer ( )
Returns
string
Since
1.23

Definition at line 92 of file RedisConnRef.php.

References Wikimedia\ObjectCache\RedisConnRef\$server.

Referenced by Wikimedia\ObjectCache\RedisConnectionPool\handleError().

◆ hScan()

Wikimedia\ObjectCache\RedisConnRef::hScan ( $key,
& $iterator,
$pattern = null,
$count = null )

Hash Scan Handle this explicitly due to needing the iterator passed by reference.

See: https://github.com/phpredis/phpredis#hScan

Parameters
string$key
int&$iterator
string | null$pattern
int | null$count
Returns
array

Definition at line 193 of file RedisConnRef.php.

◆ isConnIdentical()

Wikimedia\ObjectCache\RedisConnRef::isConnIdentical ( Redis $conn)
Parameters
Redis$conn
Returns
bool

Definition at line 304 of file RedisConnRef.php.

References Wikimedia\ObjectCache\RedisConnRef\$conn.

Referenced by Wikimedia\ObjectCache\RedisConnectionPool\handleError().

◆ luaEval()

◆ scan()

Wikimedia\ObjectCache\RedisConnRef::scan ( & $iterator,
$pattern = null,
$count = null )

Key Scan Handle this explicitly due to needing the iterator passed by reference.

See: https://github.com/phpredis/phpredis#scan

Parameters
int&$iterator
string | null$pattern
int | null$count
Returns
array

Definition at line 163 of file RedisConnRef.php.

◆ setLogger()

Wikimedia\ObjectCache\RedisConnRef::setLogger ( LoggerInterface $logger)

Definition at line 84 of file RedisConnRef.php.

References Wikimedia\ObjectCache\RedisConnRef\$logger.

◆ sScan()

Wikimedia\ObjectCache\RedisConnRef::sScan ( $key,
& $iterator,
$pattern = null,
$count = null )

Set Scan Handle this explicitly due to needing the iterator passed by reference.

See: https://github.com/phpredis/phpredis#sScan

Parameters
string$key
int&$iterator
string | null$pattern
int | null$count
Returns
array

Definition at line 178 of file RedisConnRef.php.

◆ zScan()

Wikimedia\ObjectCache\RedisConnRef::zScan ( $key,
& $iterator,
$pattern = null,
$count = null )

Sorted Set Scan Handle this explicitly due to needing the iterator passed by reference.

See: https://github.com/phpredis/phpredis#hScan

Parameters
string$key
int&$iterator
string | null$pattern
int | null$count
Returns
array

Definition at line 208 of file RedisConnRef.php.

Member Data Documentation

◆ $conn

Redis Wikimedia\ObjectCache\RedisConnRef::$conn
protected

◆ $lastError

string null Wikimedia\ObjectCache\RedisConnRef::$lastError
protected

◆ $logger

LoggerInterface Wikimedia\ObjectCache\RedisConnRef::$logger
protected

◆ $pool

RedisConnectionPool Wikimedia\ObjectCache\RedisConnRef::$pool
protected

Definition at line 41 of file RedisConnRef.php.

Referenced by Wikimedia\ObjectCache\RedisConnRef\__construct().

◆ $server

string Wikimedia\ObjectCache\RedisConnRef::$server
protected

The documentation for this class was generated from the following file: