38 private const MISS_THRESHOLD = 360;
48 if ( $context->getImage() ) {
50 } elseif ( $context->getOnly() ===
'styles' ) {
55 $modules = array_unique( $context->getModules() );
57 $cache->mKey = sha1( $context->getHash() . implode(
'|',
$modules ) );
59 $cache->mCacheWorthy =
true;
72 $mainConfig = MediaWikiServices::getInstance()->getMainConfig();
73 $useFileCache = $mainConfig->get( MainConfigNames::UseFileCache );
74 $defaultSkin = $mainConfig->get( MainConfigNames::DefaultSkin );
75 $languageCode = $mainConfig->get( MainConfigNames::LanguageCode );
76 if ( !$useFileCache ) {
80 $queryVals = $context->getRequest()->getValues();
81 foreach ( $queryVals as $query => $val ) {
82 if ( in_array( $query, [
'modules',
'image',
'variant',
'version' ] ) ) {
85 } elseif ( $query ===
'skin' && $val === $defaultSkin ) {
87 } elseif ( $query ===
'lang' && $val === $languageCode ) {
89 } elseif ( $query ===
'only' && in_array( $val, [
'styles',
'scripts' ] ) ) {
91 } elseif ( $query ===
'debug' && $val ===
'false' ) {
93 } elseif ( $query ===
'format' && $val ===
'rasterized' ) {
116 if ( $this->mCacheWorthy ===
null ) {
117 $this->mCacheWorthy = (
123 return $this->mCacheWorthy;
Base class for data storage in the file system.
getMissesRecent()
Roughly gets the cache misses in the last hour by unique visitors.
baseCacheDirectory()
Get the base file cache directory.
isCached()
Check if the cache file exists.
A class containing constants representing the names of configuration variables.
ResourceLoader request result caching in the file system.
cacheDirectory()
Get the base file cache directory.
static useFileCache(RL\Context $context)
Check if an RL request can be cached.
static newFromContext(RL\Context $context)
Construct an ResourceFileCache from a context.
isCacheWorthy()
Item has many recent cache misses.