* $setOpts = Database::getCacheSetOptions( $dbr );
* // Fetch the row from the DB
* $row = $dbr->selectRow( ... );
- * $key = wfMemcKey( 'building', $buildingId );
+ * $key = $cache->makeKey( 'building', $buildingId );
* $cache->set( $key, $row, 86400, $setOpts );
* @endcode
*
* ... <execute some stuff> ...
* // Update the row in the DB
* $dbw->update( ... );
- * $key = wfMemcKey( 'homes', $homeId );
+ * $key = $cache->makeKey( 'homes', $homeId );
* // Purge the corresponding cache entry just before committing
* $dbw->onTransactionPreCommitOrIdle( function() use ( $cache, $key ) {
* $cache->delete( $key );
* @code
* $catInfo = $cache->getWithSetCallback(
* // Key to store the cached value under
- * wfMemcKey( 'cat-attributes', $catId ),
+ * $cache->makeKey( 'cat-attributes', $catId ),
* // Time-to-live (seconds)
* 60,
* // Function that derives the new key value
* @code
* $catConfig = $cache->getWithSetCallback(
* // Key to store the cached value under
- * wfMemcKey( 'site-cat-config' ),
+ * $cache->makeKey( 'site-cat-config' ),
* // Time-to-live (seconds)
* 86400,
* // Function that derives the new key value
* },
* array(
* // Calling touchCheckKey() on this key invalidates the cache
- * 'checkKeys' => array( wfMemcKey( 'site-cat-config' ) ),
+ * 'checkKeys' => array( $cache->makeKey( 'site-cat-config' ) ),
* // Try to only let one datacenter thread manage cache updates at a time
* 'lockTSE' => 30
* )
* @code
* $catState = $cache->getWithSetCallback(
* // Key to store the cached value under
- * wfMemcKey( 'cat-state', $cat->getId() ),
+ * $cache->makeKey( 'cat-state', $cat->getId() ),
* // Time-to-live (seconds)
* 900,
* // Function that derives the new key value
* // The "check" keys that represent things the value depends on;
* // Calling touchCheckKey() on any of them invalidates the cache
* 'checkKeys' => array(
- * wfMemcKey( 'sustenance-bowls', $cat->getRoomId() ),
- * wfMemcKey( 'people-present', $cat->getHouseId() ),
- * wfMemcKey( 'cat-laws', $cat->getCityId() ),
+ * $cache->makeKey( 'sustenance-bowls', $cat->getRoomId() ),
+ * $cache->makeKey( 'people-present', $cat->getHouseId() ),
+ * $cache->makeKey( 'cat-laws', $cat->getCityId() ),
* )
* )
* );
* @code
* $lastCatActions = $cache->getWithSetCallback(
* // Key to store the cached value under
- * wfMemcKey( 'cat-last-actions', 100 ),
+ * $cache->makeKey( 'cat-last-actions', 100 ),
* // Time-to-live (seconds)
* 10,
* // Function that derives the new key value
return $value;
}
+ /**
+ * @see BagOStuff::makeKey()
+ * @param string ... Key component
+ * @return string
+ * @since 1.27
+ */
+ public function makeKey() {
+ return call_user_func_array( array( $this->cache, __FUNCTION__ ), func_get_args() );
+ }
+
+ /**
+ * @see BagOStuff::makeGlobalKey()
+ * @param string ... Key component
+ * @return string
+ * @since 1.27
+ */
+ public function makeGlobalKey() {
+ return call_user_func_array( array( $this->cache, __FUNCTION__ ), func_get_args() );
+ }
+
/**
* Get the "last error" registered; clearLastError() should be called manually
* @return int ERR_* constant for the "last error" registry