Add "generic" key methods for quickly deriving keys from key component lists in a bijective manor. This is useful for BagOStuff classes that wrap other BagOStuff instances or for parsing keys to get stats. Make the proxy BagOStuff classes (ReplicatedBagOStuff, MultiWriteBagOStuff, CachedBagOStuff) use "generic" keys so that they can convert to appropriate keys when making backing cache instance method calls. Make EmptyBagOStuff, HashBagOStuff, APCUBagOStuff, RedisBagOStuff, and RESTBagOStuff use "generic" keys rather than those of MediumSpecificBagOStuff::makeKeyInternal(). This lets proxy BagOStuff classes bypass key conversions when used with instances of these classes as backing stores. Also: * Fix missing incr(), incrWithInit(), and decr() return values in MultiWriteBagOStuff. * Make MultiWriteBagOfStuff, ReplicatedBagOStuff, and CachedBagOStuff use similar backend method forwarding styles by using a new BagOStuff method. * Improved various related bits of documentation. Bug: T250239 Bug: T235705 Change-Id: I1eb897c2cea3f5b756dd1e3c457b7cbd817599f5
27 lines
862 B
PHP
27 lines
862 B
PHP
<?php
|
|
|
|
/**
|
|
* Generic interface for object stores with key encoding methods.
|
|
*
|
|
* @ingroup Cache
|
|
* @since 1.34
|
|
*/
|
|
interface IStoreKeyEncoder {
|
|
/**
|
|
* Make a cache key using the "global" keyspace for the given components
|
|
*
|
|
* @param string $class Key collection name component
|
|
* @param string|int ...$components Key components for entity IDs
|
|
* @return string Keyspace-prepended list of encoded components as a colon-separated value
|
|
*/
|
|
public function makeGlobalKey( $class, ...$components );
|
|
|
|
/**
|
|
* Make a cache key using the default keyspace for the given components
|
|
*
|
|
* @param string $class Key collection name component
|
|
* @param string|int ...$components Key components for entity IDs
|
|
* @return string Keyspace-prepended list of encoded components as a colon-separated value
|
|
*/
|
|
public function makeKey( $class, ...$components );
|
|
}
|