MediaWiki REL1_31
|
Protected Member Functions | |
worthRefreshPopular ( $asOf, $ageNew, $timeTillRefresh, $now) | |
Check if a key is due for randomized regeneration due to its popularity. | |
Protected Member Functions inherited from WANObjectCache | |
determineKeyClass ( $key) | |
doGetWithSetCallback ( $key, $ttl, $callback, array $opts, &$asOf=null) | |
Do the actual I/O for getWithSetCallback() when needed. | |
getCurrentTime () | |
getInterimValue ( $key, $versioned, $minTime, &$asOf) | |
getProcessCache ( $group) | |
isAliveOrInGracePeriod ( $curTTL, $graceTTL) | |
Check if a key is fresh or in the grace window and thus due for randomized reuse. | |
isValid ( $value, $versioned, $asOf, $minTime) | |
Check whether $value is appropriately versioned and not older than $minTime (if set) | |
makePurgeValue ( $timestamp, $holdoff) | |
parsePurgeValue ( $value) | |
relayDelete ( $key) | |
Do the actual async bus delete of a key. | |
relayPurge ( $key, $ttl, $holdoff) | |
Do the actual async bus purge of a key. | |
setInterimValue ( $key, $wrapped, $tempTTL) | |
unwrap ( $wrapped, $now) | |
Do not use this method outside WANObjectCache. | |
worthRefreshExpiring ( $curTTL, $lowTTL) | |
Check if a key is nearing expiration and thus due for randomized regeneration. | |
wrap ( $value, $ttl, $now) | |
Do not use this method outside WANObjectCache. | |
Additional Inherited Members | |
Public Member Functions inherited from WANObjectCache | |
__construct (array $params) | |
adaptiveTTL ( $mtime, $maxTTL, $minTTL=30, $factor=0.2) | |
Get a TTL that is higher for objects that have not changed recently. | |
clearLastError () | |
Clear the "last error" registry. | |
clearProcessCache () | |
Clear the in-process caches; useful for testing. | |
delete ( $key, $ttl=self::HOLDOFF_TTL) | |
Purge a key from all datacenters. | |
get ( $key, &$curTTL=null, array $checkKeys=[], &$asOf=null) | |
Fetch the value of a key from cache. | |
getCheckKeyTime ( $key) | |
Fetch the value of a timestamp "check" key. | |
getLastError () | |
Get the "last error" registered; clearLastError() should be called manually. | |
getMulti (array $keys, &$curTTLs=[], array $checkKeys=[], array &$asOfs=[]) | |
Fetch the value of several keys from cache. | |
getMultiCheckKeyTime (array $keys) | |
Fetch the values of each timestamp "check" key. | |
getMultiWithSetCallback (ArrayIterator $keyedIds, $ttl, callable $callback, array $opts=[]) | |
Method to fetch multiple cache keys at once with regeneration. | |
getMultiWithUnionSetCallback (ArrayIterator $keyedIds, $ttl, callable $callback, array $opts=[]) | |
Method to fetch/regenerate multiple cache keys at once. | |
getQoS ( $flag) | |
getWarmupKeyMisses () | |
getWithSetCallback ( $key, $ttl, $callback, array $opts=[]) | |
Method to fetch/regenerate cache keys. | |
makeGlobalKey ( $class, $component=null) | |
makeKey ( $class, $component=null) | |
makeMultiKeys (array $entities, callable $keyFunc) | |
reap ( $key, $purgeTimestamp, &$isStale=false) | |
Set a key to soon expire in the local cluster if it pre-dates $purgeTimestamp. | |
reapCheckKey ( $key, $purgeTimestamp, &$isStale=false) | |
Set a "check" key to soon expire in the local cluster if it pre-dates $purgeTimestamp. | |
resetCheckKey ( $key) | |
Delete a "check" key from all datacenters, invalidating keys that use it. | |
set ( $key, $value, $ttl=0, array $opts=[]) | |
Set the value of a key in cache. | |
setLogger (LoggerInterface $logger) | |
setMockTime (&$time) | |
touchCheckKey ( $key, $holdoff=self::HOLDOFF_TTL) | |
Purge a "check" key from all datacenters, invalidating keys that use it. | |
useInterimHoldOffCaching ( $enabled) | |
Enable or disable the use of brief caching for tombstoned keys. | |
Static Public Member Functions inherited from WANObjectCache | |
static | newEmpty () |
Get an instance that wraps EmptyBagOStuff. | |
Public Attributes inherited from WANObjectCache | |
const | AGE_NEW = 60 |
Never consider performing "popularity" refreshes until a key reaches this age. | |
const | CHECK_KEY_TTL = self::TTL_YEAR |
Seconds to keep dependency purge keys around. | |
const | DEFAULT_PURGE_CHANNEL = 'wancache-purge' |
const | ERR_NO_RESPONSE = 1 |
const | ERR_NONE = 0 |
const | ERR_RELAY = 4 |
const | ERR_UNEXPECTED = 3 |
const | ERR_UNREACHABLE = 2 |
const | FLD_FLAGS = 4 |
const | FLD_HOLDOFF = 5 |
const | FLD_TIME = 3 |
const | FLD_TTL = 2 |
const | FLD_VALUE = 1 |
const | FLD_VERSION = 0 |
const | GRACE_TTL_NONE = 0 |
Idiom for set()/getWithSetCallback() for "no post-expired grace period". | |
const | HIT_RATE_HIGH = 1 |
Hits/second for a refresh to be expected within the "popularity" window. | |
const | HOLDOFF_NONE = 0 |
Idiom for delete() for "no hold-off". | |
const | HOLDOFF_TTL = 11 |
Seconds to tombstone keys on delete() | |
const | HOT_TTR = 900 |
The time length of the "popularity" refresh window for hot keys. | |
const | INTERIM_KEY_PREFIX = 'WANCache:i:' |
const | INTERIM_KEY_TTL = 1 |
Seconds to keep interim value keys for tombstoned keys around. | |
const | LOCK_TTL = 10 |
Seconds to keep lock keys around. | |
const | LOW_TTL = 30 |
Default remaining TTL at which to consider pre-emptive regeneration. | |
const | MAX_COMMIT_DELAY = 3 |
Max time expected to pass between delete() and DB commit finishing. | |
const | MAX_READ_LAG = 7 |
Max replication+snapshot lag before applying TTL_LAGGED or disallowing set() | |
const | MIN_TIMESTAMP_NONE = 0.0 |
Idiom for getWithSetCallback() for "no minimum required as-of timestamp". | |
const | MUTEX_KEY_PREFIX = 'WANCache:m:' |
const | PC_PRIMARY = 'primary:1000' |
const | PURGE_VAL_PREFIX = 'PURGED:' |
const | RAMPUP_TTL = 30 |
Seconds to ramp up to the "popularity" refresh chance after a key is no longer new. | |
const | STALE_TTL_NONE = 0 |
Idiom for set()/getWithSetCallback() for "do not augment the storage medium TTL". | |
const | TIME_KEY_PREFIX = 'WANCache:t:' |
const | TINY_NEGATIVE = -0.000001 |
Tiny negative float to use when CTL comes up >= 0 due to clock skew. | |
const | TSE_NONE = -1 |
Idiom for getWithSetCallback() callbacks to 'lockTSE' logic. | |
const | TTL_LAGGED = 30 |
Max TTL to store keys when a data sourced is lagged. | |
const | TTL_UNCACHEABLE = -1 |
Idiom for getWithSetCallback() callbacks to avoid calling set() | |
const | VALUE_KEY_PREFIX = 'WANCache:v:' |
const | VERSION = 1 |
Cache format version number. | |
const | VFLD_DATA = 'WOC:d' |
const | VFLD_VERSION = 'WOC:v' |
Public Attributes inherited from IExpiringStore | |
const | ATTR_EMULATION = 1 |
const | ATTR_SYNCWRITES = 2 |
const | QOS_EMULATION_SQL = 1 |
const | QOS_SYNCWRITES_BE = 2 |
const | QOS_SYNCWRITES_NONE = 1 |
const | QOS_SYNCWRITES_QC = 3 |
const | QOS_SYNCWRITES_SS = 4 |
const | QOS_UNKNOWN = INF |
const | TTL_DAY = 86400 |
const | TTL_HOUR = 3600 |
const | TTL_INDEFINITE = 0 |
const | TTL_MINUTE = 60 |
const | TTL_MONTH = 2592000 |
const | TTL_PROC_LONG = 30 |
const | TTL_PROC_SHORT = 3 |
const | TTL_SECOND = 1 |
const | TTL_WEEK = 604800 |
const | TTL_YEAR = 31536000 |
Static Protected Member Functions inherited from WANObjectCache | |
static | prefixCacheKeys (array $keys, $prefix) |
Protected Attributes inherited from WANObjectCache | |
callable null | $asyncHandler |
Function that takes a WAN cache callback and runs it later. | |
BagOStuff | $cache |
The local datacenter cache. | |
string | $cluster |
Cache cluster name for mcrouter use. | |
int | $lastRelayError = self::ERR_NONE |
ERR_* constant for the "last error" registry. | |
LoggerInterface | $logger |
$mcrouterAware | |
@bar bool Whether to use mcrouter key prefixing for routing | |
HashBagOStuff[] | $processCaches = [] |
Map of group PHP instance caches. | |
string | $purgeChannel |
Purge channel name. | |
EventRelayer | $purgeRelayer |
Bus that handles purge broadcasts. | |
string | $region |
Physical region for mcrouter use. | |
StatsdDataFactoryInterface | $stats |
bool | $useInterimHoldOffCaching = true |
Whether to use "interim" caching while keys are tombstoned. | |
Definition at line 1707 of file WANObjectCacheTest.php.
|
protected |
Check if a key is due for randomized regeneration due to its popularity.
This is used so that popular keys can preemptively refresh themselves for higher consistency (especially in the case of purge loss/delay). Unpopular keys can remain in cache with their high nominal TTL. This means popular keys keep good consistency, whether the data changes frequently or not, and long-tail keys get to stay in cache and get hits too. Similar to worthRefreshExpiring(), randomization is used.
float | $asOf | UNIX timestamp of the value |
int | $ageNew | Age of key when this might recommend refreshing (seconds) |
int | $timeTillRefresh | Age of key when it should be refreshed if popular (seconds) |
float | $now | The current UNIX timestamp |
Reimplemented from WANObjectCache.
Definition at line 1708 of file WANObjectCacheTest.php.