- * // Function that derives the new key value
- * $callback = function() { ... };
- * // Get the key value from cache or from source on cache miss;
- * // try to only let one datacenter thread manage doing cache updates
- * $opts = array( 'lockTSE' => 5, 'lowTTL' => 10 );
- * $value = $cache->getWithSetCallback( $key, $callback, 60, $checkKeys, $opts );
+ * @endcode
+ *
+ * Example usage (hot key holding most recent 100 events):
+ * @code
+ * $lastCatActions = $cache->getWithSetCallback(
+ * // Key to store the cached value under
+ * wfMemcKey( 'cat-last-actions', 100 ),
+ * // Function that derives the new key value
+ * function( $oldValue, &$ttl, array &$setOpts ) {
+ * $dbr = wfGetDB( DB_SLAVE );
+ * // Start off with the last cached list
+ * $list = $oldValue ? $oldValue : array();
+ * $last = end( $list );
+ * // Fetch any rows newer than $last from the DB (in order)
+ * $rows = iterator_to_array( $dbr->select( ... ) );
+ * // Merge them and get the new "last 100" rows
+ * $list = array_slice( array_merge( $list, $new ), -100 );
+ *
+ * // Set age of the transaction snapshot the data came from
+ * $setOpts = array( 'since' => $dbr->trxTimestamp() );
+ *
+ * return $list;
+ * },
+ * // Time-to-live (seconds)
+ * 10
+ * // No "check" keys
+ * array(),
+ * // Try to only let one datacenter thread manage cache updates at a time
+ * array( 'lockTSE' => 30 )
+ * ) );