MediaWiki  REL1_24
BloomCacheRedis Class Reference

Bloom filter implemented using Redis. More...

Inheritance diagram for BloomCacheRedis:
Collaboration diagram for BloomCacheRedis:

List of all members.

Public Member Functions

 __construct (array $config)
 include:
 getScopedLock ($virtualKey)
 Get an exclusive lock on a filter for updates.

Protected Member Functions

 doAdd ($key, array $members)
 doDelete ($key)
 doGetStatus ($virtualKey)
 doInit ($key, $size, $precision)
 doIsHit ($key, $member)
 doSetStatus ($virtualKey, array $values)
 getConnection ($to)
 $param string $to (master/slave)
 getSegment ($member)
 handleException (RedisConnRef $conn, $e)

Protected Attributes

RedisLockManager $lockMgr
 *
RedisConnectionPool $redisPool
 *
integer $segments = 128
 Federate each filter into this many redis bitfield objects *.
array $servers
 *

Detailed Description

Bloom filter implemented using Redis.

The Redis server must be >= 2.6 and should have volatile-lru or volatile-ttl if there is any eviction policy. It should not be allkeys-* in any case. Also, this can be used in a simple master/slave setup or with Redis Sentinel preferably.

Some bits are based on https://github.com/ErikDubbelboer/redis-lua-scaling-bloom-filter but are simplified to use a single filter instead of up to 32 filters.

Since:
1.24

Definition at line 34 of file BloomCacheRedis.php.


Constructor & Destructor Documentation

include:

  • redisServers : list of servers (address:<port>) (the first is the master)
  • redisConf : additional redis configuration
Parameters:
array$config

Reimplemented from BloomCache.

Definition at line 47 of file BloomCacheRedis.php.


Member Function Documentation

BloomCacheRedis::doAdd ( key,
array members 
) [protected]
Parameters:
string$key
array$members
Returns:
bool Success

Reimplemented from BloomCache.

Definition at line 113 of file BloomCacheRedis.php.

BloomCacheRedis::doDelete ( key) [protected]
Parameters:
string$key
Returns:
bool Success

Reimplemented from BloomCache.

Definition at line 291 of file BloomCacheRedis.php.

BloomCacheRedis::doGetStatus ( key) [protected]
Parameters:
string$key
Returns:
array|bool

Reimplemented from BloomCache.

Definition at line 202 of file BloomCacheRedis.php.

BloomCacheRedis::doInit ( key,
size,
precision 
) [protected]
Parameters:
string$key
integer$sizeBit length
float$precision
Returns:
bool Success

Reimplemented from BloomCache.

Definition at line 61 of file BloomCacheRedis.php.

BloomCacheRedis::doIsHit ( key,
member 
) [protected]
Parameters:
string$key
string$member
Returns:
bool|null

Reimplemented from BloomCache.

Definition at line 224 of file BloomCacheRedis.php.

BloomCacheRedis::doSetStatus ( virtualKey,
array values 
) [protected]
Parameters:
string$virtualKey
array$values
Returns:
bool Success

Reimplemented from BloomCache.

Definition at line 186 of file BloomCacheRedis.php.

BloomCacheRedis::getConnection ( to) [protected]

$param string $to (master/slave)

Returns:
RedisConnRef|bool Returns false on failure

Definition at line 330 of file BloomCacheRedis.php.

BloomCacheRedis::getScopedLock ( virtualKey)

Get an exclusive lock on a filter for updates.

Parameters:
string$virtualKey
Returns:
ScopedCallback|ScopedLock|null Returns null if acquisition failed

Reimplemented from BloomCache.

Definition at line 312 of file BloomCacheRedis.php.

BloomCacheRedis::getSegment ( member) [protected]
Parameters:
string$member
Returns:
integer

Definition at line 322 of file BloomCacheRedis.php.

BloomCacheRedis::handleException ( RedisConnRef conn,
e 
) [protected]
Parameters:
RedisConnRef$conn
Exception$e

Definition at line 363 of file BloomCacheRedis.php.


Member Data Documentation

RedisLockManager BloomCacheRedis::$lockMgr [protected]

*

Definition at line 36 of file BloomCacheRedis.php.

RedisConnectionPool BloomCacheRedis::$redisPool [protected]

*

Definition at line 35 of file BloomCacheRedis.php.

integer BloomCacheRedis::$segments = 128 [protected]

Federate each filter into this many redis bitfield objects *.

Definition at line 38 of file BloomCacheRedis.php.

array BloomCacheRedis::$servers [protected]

*

Definition at line 37 of file BloomCacheRedis.php.


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