MediaWiki REL1_39
EmptyBagOStuff.php
Go to the documentation of this file.
1<?php
30 public function __construct( array $params = [] ) {
31 parent::__construct( $params );
32
33 $this->attrMap[self::ATTR_DURABILITY] = self::QOS_DURABILITY_NONE;
34 }
35
36 protected function doGet( $key, $flags = 0, &$casToken = null ) {
37 $casToken = null;
38
39 return false;
40 }
41
42 protected function doSet( $key, $value, $exptime = 0, $flags = 0 ) {
43 return true;
44 }
45
46 protected function doDelete( $key, $flags = 0 ) {
47 return true;
48 }
49
50 protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) {
51 return true;
52 }
53
54 public function incr( $key, $value = 1, $flags = 0 ) {
55 return false;
56 }
57
58 public function decr( $key, $value = 1, $flags = 0 ) {
59 return false;
60 }
61
62 protected function doIncrWithInit( $key, $exptime, $step, $init, $flags ) {
63 // faster
64 return $init;
65 }
66
67 public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
68 // faster
69 return true;
70 }
71
72 public function setNewPreparedValues( array $valueByKey ) {
73 // Do not bother staging serialized values as this class does not serialize values
74 return $this->guessSerialSizeOfValues( $valueByKey );
75 }
76
77 public function makeKeyInternal( $keyspace, $components ) {
78 return $this->genericKeyFromComponents( $keyspace, ...$components );
79 }
80
81 protected function convertGenericKey( $key ) {
82 // short-circuit; already uses "generic" keys
83 return $key;
84 }
85}
genericKeyFromComponents(... $components)
At a minimum, there must be a keyspace and collection name component.
string $keyspace
Default keyspace; used by makeKey()
A BagOStuff object with no objects in it.
setNewPreparedValues(array $valueByKey)
Stage a set of new key values for storage and estimate the amount of bytes needed.
incr( $key, $value=1, $flags=0)
Increase stored value of $key by $value while preserving its TTL.
doIncrWithInit( $key, $exptime, $step, $init, $flags)
makeKeyInternal( $keyspace, $components)
Make a cache key for the given keyspace and components.
doGet( $key, $flags=0, &$casToken=null)
Get an item.
decr( $key, $value=1, $flags=0)
Decrease stored value of $key by $value while preserving its TTL.
doSet( $key, $value, $exptime=0, $flags=0)
Set an item.
doDelete( $key, $flags=0)
Delete an item.
__construct(array $params=[])
convertGenericKey( $key)
Convert a "generic" reversible cache key into one for this cache.
merge( $key, callable $callback, $exptime=0, $attempts=10, $flags=0)
Merge changes into the existing cache value (possibly creating a new one)
doAdd( $key, $value, $exptime=0, $flags=0)
Insert an item if it does not already exist.
Storage medium specific cache for storing items (e.g.
guessSerialSizeOfValues(array $values)
Estimate the size of a each variable once serialized.