MediaWiki master
EmptyBagOStuff.php
Go to the documentation of this file.
1<?php
20namespace Wikimedia\ObjectCache;
21
32 public function __construct( array $params = [] ) {
33 parent::__construct( $params );
34
36 }
37
38 protected function doGet( $key, $flags = 0, &$casToken = null ) {
39 $casToken = null;
40
41 return false;
42 }
43
44 protected function doSet( $key, $value, $exptime = 0, $flags = 0 ) {
45 return true;
46 }
47
48 protected function doDelete( $key, $flags = 0 ) {
49 return true;
50 }
51
52 protected function doAdd( $key, $value, $exptime = 0, $flags = 0 ) {
53 return true;
54 }
55
56 protected function doIncrWithInit( $key, $exptime, $step, $init, $flags ) {
57 // faster
58 return $init;
59 }
60
61 public function merge( $key, callable $callback, $exptime = 0, $attempts = 10, $flags = 0 ) {
62 // faster
63 return true;
64 }
65}
66
68class_alias( EmptyBagOStuff::class, 'EmptyBagOStuff' );
array $params
The job parameters.
No-op implementation that stores nothing.
doAdd( $key, $value, $exptime=0, $flags=0)
Insert an item if it does not already exist.
merge( $key, callable $callback, $exptime=0, $attempts=10, $flags=0)
Merge changes into the existing cache value (possibly creating a new one)
doDelete( $key, $flags=0)
Delete an item.
doGet( $key, $flags=0, &$casToken=null)
Get an item.
doSet( $key, $value, $exptime=0, $flags=0)
Set an item.
doIncrWithInit( $key, $exptime, $step, $init, $flags)
Helper classs that implements most of BagOStuff for a backend.
const QOS_DURABILITY_NONE
Data is never saved to begin with (blackhole store)
const ATTR_DURABILITY
Durability of writes; see QOS_DURABILITY_* (higher means stronger)