X-Git-Url: https://git.heureux-cyclage.org/?a=blobdiff_plain;f=includes%2Flibs%2FProcessCacheLRU.php;h=ce97142d77f394591c3247b9f178281defad73d9;hb=84b263583edf2b4e2ec8c5b9cb9218751bc0c2b6;hp=f988207a897745fb9c401487cf64c89f639a9d85;hpb=9f3dd6ceb2193056eea1b334bfca67d546594df1;p=lhc%2Fweb%2Fwiklou.git diff --git a/includes/libs/ProcessCacheLRU.php b/includes/libs/ProcessCacheLRU.php index f988207a89..ce97142d77 100644 --- a/includes/libs/ProcessCacheLRU.php +++ b/includes/libs/ProcessCacheLRU.php @@ -61,7 +61,7 @@ class ProcessCacheLRU { unset( $this->cacheTimes[$evictKey] ); } $this->cache[$key][$prop] = $value; - $this->cacheTimes[$key][$prop] = time(); + $this->cacheTimes[$key][$prop] = microtime( true ); } /** @@ -69,12 +69,13 @@ class ProcessCacheLRU { * * @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 @@ class ProcessCacheLRU { * * @param $maxKeys integer * @return void + * @throws UnexpectedValueException */ public function resize( $maxKeys ) { if ( !is_int( $maxKeys ) || $maxKeys < 1 ) {