class vB_Datastore_Memcached extends vB_Datastore

Class for fetching and initializing the vBulletin datastore from a Memcache Server

Traits

Constants

BITFIELDS_TITLE

BITFIELDS_PREFIX

Properties

protected array $defaultitems Default items that are always loaded by fetch(); from vB_Datastore
protected string $prefix Unique prefix for item's title, required for multiple forums on the same server using the same classes that read/write to memory from vB_Datastore
protected bool $checked_options Whether we have verified that options were loaded correctly. from vB_Datastore
protected array $config Contains the config variables loaded from the config file from vB_Datastore
protected vB_dB_Assertor $db_assertor Contains the assertor object from vB_Datastore
protected $pending from vB_Datastore
protected array $registered All of the entries that have already been fetched from vB_Datastore
protected $registeredBitfields from vB_Datastore
protected $noValues from vB_Datastore
protected Memcache $memcache The Memcache object
protected boolean $memcache_set To prevent locking when the memcached has been restarted we want to use add rather than set
protected boolean $store_result Indicates if the result of a call to the register function should store the value in memory

Methods

__sleep()

No description

__wakeup()

No description

__construct($config, $db_assertor)

No description

resetCache()

Resets datastore cache

preload(array $titles)

Set an array of items that should be preloaded. These will not be loaded immediately but will be fetched on the first call to getValue.

get_value($title) deprecated

No description

registerCount()

No description

getValue($title)

No description

getOption($name)

No description

setOption($name, $value, $save = true)

No description

setValue(string $title, mixed $value)

This method is intended only for unit testing. Do NOT use it in other context.

clearValues()

This method is intended only for unit testing. Do NOT use it in other context.

build(string $title = '', string $data = '', int $unserialize = 0, bool $storelocal = true)

Updates the appropriate cache file

none
delete($title)

Delete a datastore entry

array(string)
getKeys()

Get the list of all datastore keys

init_registry() deprecated

Temporary function to manage initializing the legacy registry from the datastore

update_registry($title, $data)

No description

boolean
register(string $title, mixed $data, integer $unserialize_detect = 2)

Sorts the data returned from the cache and places it into appropriate places

array
prepare_itemarray(array $items)

Prepares a list of items for fetching.

string
prepare_itemlist(array $items, bool $prepare_items = false)

Prepares an array of items into a list.

boolean
fetch(array $items)

Fetches the contents of the datastore from a Memcache Server

fastDSFetch($items)

Tries to get values from fastDS, if available. Done this way to make interitance of fetch() easier.

bool
do_db_fetch(string $itemlist)

Performs the actual fetching of the datastore items for the database, child classes may use this

check_options()

Checks that the options item has come out of the datastore correctly and sets the 'versionnumber' variable

check_pseudo_options()

Checks that certain pseudo-options (versionnumber and facebookactive) are set correctly

array
build_options()

Reads settings from the settings then saves the values to the datastore

mixed
validate_setting_value(mixed $value, string $datatype, boolean $bool_as_int = true, boolean $username_query = true)

Validates the provided value of a setting against its datatype.

buildUserGroupCache(array $usergroupinfo)

Gets usergroup data to save it in the datastore and update the related values.

mixed
do_fetch(mixed $items)

Fetches the data from memcache server and registers the items found.

storeMemcache($title, $data)

No description

Details

in vB_Trait_NoSerialize at line 15
__sleep()

in vB_Trait_NoSerialize at line 20
__wakeup()

at line 43
__construct($config, $db_assertor)

Parameters

$config
$db_assertor

at line 54
resetCache()

Resets datastore cache

in vB_Datastore at line 132
preload(array $titles)

Set an array of items that should be preloaded. These will not be loaded immediately but will be fetched on the first call to getValue.

Parameters

array $titles

in vB_Datastore at line 155
get_value($title) deprecated

deprecated

Parameters

$title

in vB_Datastore at line 160
registerCount()

in vB_Datastore at line 165
getValue($title)

Parameters

$title

in vB_Datastore at line 190
getOption($name)

Parameters

$name

in vB_Datastore at line 200
setOption($name, $value, $save = true)

Parameters

$name
$value
$save

in vB_Datastore at line 233
setValue(string $title, mixed $value)

This method is intended only for unit testing. Do NOT use it in other context.

Parameters

string $title
mixed $value value

at line 223
clearValues()

This method is intended only for unit testing. Do NOT use it in other context.

Clear all the cache class vars, useful to calculate every value again.

at line 175
build(string $title = '', string $data = '', int $unserialize = 0, bool $storelocal = true)

Updates the appropriate cache file

Parameters

string $title
string $data
int $unserialize
bool $storelocal -- if we should keep a local copy in memory as if this item had been loaded. This prevents the mass rebuilding of large datastore items from overloading the available memory.

at line 183
none delete($title)

Delete a datastore entry

Parameters

$title datastore entry to delete

Return Value

none

in vB_Datastore at line 354
array(string) getKeys()

Get the list of all datastore keys

Return Value

array(string) titles of the datastore keys stored.

in vB_Datastore at line 366
init_registry() deprecated

deprecated

Temporary function to manage initializing the legacy registry from the datastore

in vB_Datastore at line 375
protected update_registry($title, $data)

Parameters

$title
$data

at line 158
protected boolean register(string $title, mixed $data, integer $unserialize_detect = 2)

Sorts the data returned from the cache and places it into appropriate places

Parameters

string $title The name of the data item to be processed
mixed $data The data associated with the title
integer $unserialize_detect If the data needs to be unserialized, 0 = no, 1 = yes, 2 = auto detect

Return Value

boolean

in vB_Datastore at line 475
protected array prepare_itemarray(array $items)

Prepares a list of items for fetching.

Items that are already fetched are skipped.

Parameters

array $items string $items - Array of item titles that are required

Return Value

array string - An array of items that need to be fetched

in vB_Datastore at line 522
protected string prepare_itemlist(array $items, bool $prepare_items = false)

Prepares an array of items into a list.

The result is a comma delimited, db escaped, quoted list for use in SQL.

Parameters

array $items string $items - An array of item titles
bool $prepare_items
  • Wether to check the items first

Return Value

string
  • A sql safe comma delimited list

at line 66
boolean fetch(array $items)

Fetches the contents of the datastore from a Memcache Server

Parameters

array $items Array of items to fetch from the datastore

Return Value

boolean

in vB_Datastore at line 569
protected fastDSFetch($items)

Tries to get values from fastDS, if available. Done this way to make interitance of fetch() easier.

Parameters

$items

in vB_Datastore at line 597
protected bool do_db_fetch(string $itemlist)

Performs the actual fetching of the datastore items for the database, child classes may use this

Parameters

string $itemlist title of the datastore item

Return Value

bool Valid Query?

in vB_Datastore at line 632
protected check_options()

Checks that the options item has come out of the datastore correctly and sets the 'versionnumber' variable

in vB_Datastore at line 658
protected check_pseudo_options()

Checks that certain pseudo-options (versionnumber and facebookactive) are set correctly

in vB_Datastore at line 698
array build_options()

Reads settings from the settings then saves the values to the datastore

After reading the contents of the setting table, the function will rebuild the $vbulletin->options array, then serialize the array and save that serialized array into the 'options' entry of the datastore in the database

Extracted from adminfunctions.php

Return Value

array The $vbulletin->options array

in vB_Datastore at line 762
protected mixed validate_setting_value(mixed $value, string $datatype, boolean $bool_as_int = true, boolean $username_query = true)

Validates the provided value of a setting against its datatype.

Extracted from adminfunctions_options

Parameters

mixed $value (ref) Setting value
string $datatype Setting datatype ('number', 'boolean' or other)
boolean $bool_as_int Represent boolean with 1/0 instead of true/false
boolean $username_query Query database for username type

Return Value

mixed Setting value

in vB_Datastore at line 875
buildUserGroupCache(array $usergroupinfo)

Gets usergroup data to save it in the datastore and update the related values.

This includes some validations to keep consistency in the datastore and db.

Parameters

array $usergroupinfo An array containing the usergroups information.

@param  array   The saved usergroup info

at line 116
protected mixed do_fetch(mixed $items)

Fetches the data from memcache server and registers the items found.

Parameters

mixed $items array of strings, each of which is a cache key

Return Value

mixed array of strings, each of which is a cache key that is not in memcache

at line 197
protected storeMemcache($title, $data)

Parameters

$title
$data