jenkins-bot has submitted this change and it was merged.

Change subject: Improved timestamp precision in ProcessCacheLRU
......................................................................


Improved timestamp precision in ProcessCacheLRU

Change-Id: I42f27df4ec9f944bd308e13eb832d84f1d9492a9
---
M includes/libs/ProcessCacheLRU.php
1 file changed, 6 insertions(+), 4 deletions(-)

Approvals:
  Chad: Looks good to me, approved
  jenkins-bot: Verified



diff --git a/includes/libs/ProcessCacheLRU.php 
b/includes/libs/ProcessCacheLRU.php
index f988207..ce97142 100644
--- a/includes/libs/ProcessCacheLRU.php
+++ b/includes/libs/ProcessCacheLRU.php
@@ -61,7 +61,7 @@
                        unset( $this->cacheTimes[$evictKey] );
                }
                $this->cache[$key][$prop] = $value;
-               $this->cacheTimes[$key][$prop] = time();
+               $this->cacheTimes[$key][$prop] = microtime( true );
        }
 
        /**
@@ -69,12 +69,13 @@
         *
         * @param $key string
         * @param $prop string
-        * @param $maxAge integer Ignore items older than this many seconds 
(since 1.21)
+        * @param $maxAge float Ignore items older than this many seconds 
(since 1.21)
         * @return bool
         */
-       public function has( $key, $prop, $maxAge = 0 ) {
+       public function has( $key, $prop, $maxAge = 0.0 ) {
                if ( isset( $this->cache[$key][$prop] ) ) {
-                       return ( $maxAge <= 0 || ( time() - 
$this->cacheTimes[$key][$prop] ) <= $maxAge );
+                       return ( $maxAge <= 0 ||
+                               ( microtime( true ) - 
$this->cacheTimes[$key][$prop] ) <= $maxAge );
                }
 
                return false;
@@ -121,6 +122,7 @@
         *
         * @param $maxKeys integer
         * @return void
+        * @throws UnexpectedValueException
         */
        public function resize( $maxKeys ) {
                if ( !is_int( $maxKeys ) || $maxKeys < 1 ) {

-- 
To view, visit https://gerrit.wikimedia.org/r/162950
To unsubscribe, visit https://gerrit.wikimedia.org/r/settings

Gerrit-MessageType: merged
Gerrit-Change-Id: I42f27df4ec9f944bd308e13eb832d84f1d9492a9
Gerrit-PatchSet: 1
Gerrit-Project: mediawiki/core
Gerrit-Branch: master
Gerrit-Owner: Aaron Schulz <[email protected]>
Gerrit-Reviewer: Chad <[email protected]>
Gerrit-Reviewer: Reedy <[email protected]>
Gerrit-Reviewer: jenkins-bot <>

_______________________________________________
MediaWiki-commits mailing list
[email protected]
https://lists.wikimedia.org/mailman/listinfo/mediawiki-commits

Reply via email to