/**
* Like resolveStoragePath() except null values are returned if
* the container is sharded and the shard could not be determined
- * or if the path ends with '/'. The later case is illegal for FS
+ * or if the path ends with '/'. The latter case is illegal for FS
* backends and can confuse listings for object store backends.
*
* This function is used when resolving paths that must be valid
if ( $path === null ) {
return; // invalid storage path
}
- $age = time() - wfTimestamp( TS_UNIX, $val['mtime'] );
- $ttl = min( 7 * 86400, max( 300, floor( .1 * $age ) ) );
+ $mtime = wfTimestamp( TS_UNIX, $val['mtime'] );
+ $ttl = $this->memCache->adaptiveTTL( $mtime, 7 * 86400, 300, .1 );
$key = $this->fileCacheKey( $path );
// Set the cache unless it is currently salted.
$this->memCache->set( $key, $val, $ttl );