objectcache: detect default getWithSetCallback() set options
[lhc/web/wiklou.git] / includes / libs / rdbms / loadbalancer / ILoadBalancer.php
index 8854479..65b18e7 100644 (file)
@@ -549,4 +549,32 @@ interface ILoadBalancer {
         * @param array[] $aliases Map of (table => (dbname, schema, prefix) map)
         */
        public function setTableAliases( array $aliases );
+
+       /**
+        * Mark the beginning of a new section to track database usage information for
+        *
+        * This returns an ID which can be passed to declareUsageSectionEnd() to indicate
+        * the end of the section. If $id is provided, the returned ID equals $id.
+        * @param string|integer Section ID to use instead of auto-generated ID [optional]
+        * @return string|integer
+        */
+       public function declareUsageSectionStart( $id = null );
+
+       /**
+        * End a section started by declareUsageSectionStart() and return the information map
+        *
+        * The map includes information about activity during the section:
+        *   - readQueries: number of read queries issued.
+        *   - writeQueries: number of write queries issued.
+        *   - cacheSetOptions: result of pessimistically merging the result of getCacheSetOptions()
+        *      on each DB handle before the first query of the respective handle. This is null if
+        *      no actual queries took place in the section interval.
+        *
+        * This can be called before cache value generation functions commence queries
+        * and then passed the caching storage layer to detect and avoid lag race conditions.
+        *
+        * @param integer|string $id Section ID passed to declareUsageSectionStart() earlier
+        * @return array
+        */
+       public function declareUsageSectionEnd( $id );
 }