objectcache: add IStoreKeyEncoder interface for key generation helper methods
[lhc/web/wiklou.git] / includes / libs / objectcache / WANObjectCache.php
index 8f0b539..2487920 100644 (file)
@@ -113,7 +113,7 @@ use Psr\Log\NullLogger;
  * @ingroup Cache
  * @since 1.26
  */
-class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
+class WANObjectCache implements IExpiringStore, IStoreKeyEncoder, LoggerAwareInterface {
        /** @var BagOStuff The local datacenter cache */
        protected $cache;
        /** @var MapCacheLRU[] Map of group PHP instance caches */
@@ -1464,7 +1464,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @param string $kClass
         * @param float $elapsed Seconds spent regenerating the value
         * @param float $lockTSE
-        * @param $hasLock bool
+        * @param bool $hasLock
         * @return bool Whether it is OK to proceed with a key set operation
         */
        private function checkAndSetCooloff( $key, $kClass, $elapsed, $lockTSE, $hasLock ) {
@@ -2325,7 +2325,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @return string A collection name to describe this class of key
         */
        protected function determineKeyClassForStats( $key ) {
-               $parts = explode( ':', $key );
+               $parts = explode( ':', $key, 3 );
 
                return $parts[1] ?? $parts[0]; // sanity
        }