Merge "Rewrite pref cleanup script"
[lhc/web/wiklou.git] / includes / libs / objectcache / WANObjectCache.php
index 36b45a1..08424c9 100644 (file)
@@ -214,6 +214,9 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
                $this->asyncHandler = isset( $params['asyncHandler'] ) ? $params['asyncHandler'] : null;
        }
 
+       /**
+        * @param LoggerInterface $logger
+        */
        public function setLogger( LoggerInterface $logger ) {
                $this->logger = $logger;
        }
@@ -416,6 +419,12 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         *
         * Setting 'lag' and 'since' help avoids keys getting stuck in stale states.
         *
+        * Be aware that this does not update the process cache for getWithSetCallback()
+        * callers. Keys accessed via that method are not generally meant to also be set
+        * using this primitive method.
+        *
+        * Do not use this method on versioned keys accessed via getWithSetCallback().
+        *
         * Example usage:
         * @code
         *     $dbr = wfGetDB( DB_REPLICA );
@@ -532,6 +541,10 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         *
         * Note that set() can also be lag-aware and lower the TTL if it's high.
         *
+        * Be aware that this does not clear the process cache. Even if it did, callbacks
+        * used by getWithSetCallback() might still return stale data in the case of either
+        * uncommitted or not-yet-replicated changes (callback generally use replica DBs).
+        *
         * When using potentially long-running ACID transactions, a good pattern is
         * to use a pre-commit hook to issue the delete. This means that immediately
         * after commit, callers will see the tombstone in cache upon purge relay.
@@ -1238,7 +1251,7 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * @param string $key
         * @param bool $versioned
         * @param float $minTime
-        * @param mixed $asOf
+        * @param mixed &$asOf
         * @return mixed
         */
        protected function getInterimValue( $key, $versioned, $minTime, &$asOf ) {
@@ -1374,8 +1387,8 @@ class WANObjectCache implements IExpiringStore, LoggerAwareInterface {
         * This works the same as getWithSetCallback() except:
         *   - a) The $keys argument expects the result of WANObjectCache::makeMultiKeys()
         *   - b) The $callback argument expects a callback returning a map of (ID => new value)
-        *        for all entity IDs in $regenById and it takes the following arguments:
-        *          - $ids: a list of entity IDs to regenerate
+        *        for all entity IDs in $ids and it takes the following arguments:
+        *          - $ids: a list of entity IDs that require cache regeneration
         *          - &$ttls: a reference to the (entity ID => new TTL) map
         *          - &$setOpts: a reference to options for set() which can be altered
         *   - c) The return value is a map of (cache key => value) in the order of $keyedIds