wiki.techinc.nl/includes/libs/objectcache/IStoreKeyEncoder.php
Aaron Schulz ba8bf19416 objectcache: add size/character recommendations to IStoreKeyEncoder
Change-Id: I6928c33c88e47e5d384b35fe7bcfcf956aaabd41
2022-05-16 15:41:45 +00:00

41 lines
1.6 KiB
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
*
* Callers should:
* - Limit the collection name (first component) to 48 characters
* - Use hashes for any components based on user-supplied input
*
* Encoding is limited to the escaping of delimiter (":") and escape ("%") characters.
* Any backend-specific encoding should be delegated to methods that use the network.
*
* @param string $collection Key collection name component
* @param string|int ...$components Additional, ordered, key components for entity IDs
* @return string Colon-separated, keyspace-prepended, ordered list of encoded components
*/
public function makeGlobalKey( $collection, ...$components );
/**
* Make a cache key using the default keyspace for the given components
*
* Callers should:
* - Limit the collection name (first component) to 48 characters
* - Use hashes for any components based on user-supplied input
*
* Encoding is limited to the escaping of delimiter (":") and escape ("%") characters.
* Any backend-specific encoding should be delegated to methods that use the network.
*
* @param string $collection Key collection name component
* @param string|int ...$components Additional, ordered, key components for entity IDs
* @return string Colon-separated, keyspace-prepended, ordered list of encoded components
*/
public function makeKey( $collection, ...$components );
}