[ Index ]

PHP Cross Reference of MediaWiki-1.24.0

title

Body

[close]

/includes/cache/bloom/ -> BloomCache.php (summary)

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.

Author: Aaron Schulz
File Size: 323 lines (9 kb)
Included or required:0 times
Referenced: 2 times
Includes or requires: 0 files

Defines 1 class

EmptyBloomCache:: (7 methods):
  __construct()
  doInit()
  doAdd()
  doIsHit()
  doDelete()
  doSetStatus()
  doGetStatus()

Defines 7 functions

  get()
  __construct()
  check()
  insert()
  init()
  add()
  isHit()
  delete()
  setStatus()
  getStatus()
  getScopedLock()

Class: EmptyBloomCache  - X-Ref


__construct( array $config )   X-Ref
No description

doInit( $key, $size, $precision )   X-Ref
No description

doAdd( $key, array $members )   X-Ref
No description

doIsHit( $key, $member )   X-Ref
No description

doDelete( $key )   X-Ref
No description

doSetStatus( $virtualKey, array $values )   X-Ref
No description

doGetStatus( $virtualKey )   X-Ref
No description

Functions
Functions that are not part of a class:

get( $id )   X-Ref

param: string $id
return: BloomCache

__construct( array $config )   X-Ref
Create a new bloom cache instance from configuration.
This should only be called from within BloomCache.

param: array $config Parameters include:

check( $domain, $type, $member )   X-Ref
Check if a member is set in the bloom filter

A member being set means that it *might* have been added.
A member not being set means it *could not* have been added.

This abstracts over isHit() to deal with filter updates and readiness.
A class must exist with the name BloomFilter<type> and a static public
mergeAndCheck() method. The later takes the following arguments:
(BloomCache $bcache, $domain, $virtualKey, array $status)
The method should return a bool indicating whether to use the filter.

The 'shared' bloom key must be used for any updates and will be used
for the membership check if the method returns true. Since the key is shared,
the method should never use delete(). The filter cannot be used in cases where
membership in the filter needs to be taken away. In such cases, code *cannot*
use this method - instead, it can directly use the other BloomCache methods
to manage custom filters with their own keys (e.g. not 'shared').

param: string $domain
param: string $type
param: string $member
return: bool True if set, false if not (also returns true on error)

insert( $domain, $type, $members )   X-Ref
Inform the bloom filter of a new member in order to keep it up to date

param: string $domain
param: string $type
param: string|array $members
return: bool Success

init( $key, $size = 1000000, $precision = .001 )   X-Ref
Create a new bloom filter at $key (if one does not exist yet)

param: string $key
param: integer $size Bit length [default: 1000000]
param: float $precision [default: .001]
return: bool Success

add( $key, $members )   X-Ref
Add a member to the bloom filter at $key

param: string $key
param: string|array $members
return: bool Success

isHit( $key, $member )   X-Ref
Check if a member is set in the bloom filter.

A member being set means that it *might* have been added.
A member not being set means it *could not* have been added.

If this returns true, then the caller usually should do the
expensive check (whatever that may be). It can be avoided otherwise.

param: string $key
param: string $member
return: bool|null True if set, false if not, null on error

delete( $key )   X-Ref
Destroy a bloom filter at $key

param: string $key
return: bool Success

setStatus( $virtualKey, array $values )   X-Ref
Set the status map of the virtual bloom filter at $key

param: string $virtualKey
param: array $values Map including some of (lastID, asOfTime, epoch)
return: bool Success

getStatus( $virtualKey )   X-Ref
Get the status map of the virtual bloom filter at $key

The map includes:
- lastID    : the highest ID of the items merged in
- asOfTime  : UNIX timestamp that the filter is up-to-date as of
- epoch     : UNIX timestamp that filter started being populated
Unset fields will have a null value.

param: string $virtualKey
return: array|bool False on failure

getScopedLock( $virtualKey )   X-Ref
Get an exclusive lock on a filter for updates

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



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