MediaWiki REL1_27
ResourceFileCache Class Reference

ResourceLoader request result caching in the file system. More...

Inheritance diagram for ResourceFileCache:
Collaboration diagram for ResourceFileCache:

Public Member Functions

 isCacheWorthy ()
 Item has many recent cache misses.
 
- Public Member Functions inherited from FileCacheBase
 cacheTimestamp ()
 Get the last-modified timestamp of the cache file.
 
 clearCache ()
 Clear the cache for this page.
 
 fetchText ()
 Get the uncompressed text from the cache.
 
 getMissesRecent ()
 Roughly gets the cache misses in the last hour by unique visitors.
 
 incrMissesRecent (WebRequest $request)
 Roughly increments the cache misses in the last hour by unique visitors.
 
 isCached ()
 Check if the cache file exists.
 
 isCacheGood ( $timestamp='')
 Check if up to date cache file exists.
 
 saveText ( $text)
 Save and compress text to the cache.
 

Static Public Member Functions

static newFromContext (ResourceLoaderContext $context)
 Construct an ResourceFileCache from a context.
 
static useFileCache (ResourceLoaderContext $context)
 Check if an RL request can be cached.
 

Public Attributes

const MISS_THRESHOLD = 360
 
- Public Attributes inherited from FileCacheBase
const MISS_FACTOR = 15
 
const MISS_TTL_SEC = 3600
 

Protected Member Functions

 cacheDirectory ()
 Get the base file cache directory.
 
- Protected Member Functions inherited from FileCacheBase
 __construct ()
 
 baseCacheDirectory ()
 Get the base file cache directory.
 
 cacheMissKey ()
 
 cachePath ()
 Get the path to the cache file.
 
 checkCacheDirs ()
 Create parent directors of $this->cachePath()
 
 hashSubdirectory ()
 Return relative multi-level hash subdirectory (with trailing slash) or the empty string if not $wgFileCacheDepth.
 
 typeSubdirectory ()
 Get the cache type subdirectory (with trailing slash) An extending class could use that method to alter the type -> directory mapping.
 
 useGzip ()
 Check if the cache is gzipped.
 

Protected Attributes

 $mCacheWorthy
 
- Protected Attributes inherited from FileCacheBase
 $mCached
 
 $mExt = 'cache'
 
 $mFilePath
 
 $mKey
 
 $mType = 'object'
 
 $mUseGzip
 

Detailed Description

ResourceLoader request result caching in the file system.

Definition at line 29 of file ResourceFileCache.php.

Member Function Documentation

◆ cacheDirectory()

ResourceFileCache::cacheDirectory ( )
protected

Get the base file cache directory.

Returns
string

Reimplemented from FileCacheBase.

Definition at line 99 of file ResourceFileCache.php.

References FileCacheBase\baseCacheDirectory().

◆ isCacheWorthy()

ResourceFileCache::isCacheWorthy ( )

Item has many recent cache misses.

Returns
bool

Definition at line 107 of file ResourceFileCache.php.

References $mCacheWorthy, FileCacheBase\getMissesRecent(), and FileCacheBase\isCached().

◆ newFromContext()

static ResourceFileCache::newFromContext ( ResourceLoaderContext  $context)
static

Construct an ResourceFileCache from a context.

Parameters
ResourceLoaderContext$context
Returns
ResourceFileCache

Definition at line 40 of file ResourceFileCache.php.

References $cache, and $context.

Referenced by ResourceLoader\respond().

◆ useFileCache()

static ResourceFileCache::useFileCache ( ResourceLoaderContext  $context)
static

Check if an RL request can be cached.

Caller is responsible for checking if any modules are private.

Parameters
ResourceLoaderContext$context
Returns
bool

Definition at line 66 of file ResourceFileCache.php.

References $context, $query, $wgDefaultSkin, $wgLanguageCode, $wgUseFileCache, as, and global.

Referenced by ResourceLoader\respond().

Member Data Documentation

◆ $mCacheWorthy

ResourceFileCache::$mCacheWorthy
protected

Definition at line 30 of file ResourceFileCache.php.

Referenced by isCacheWorthy().

◆ MISS_THRESHOLD

const ResourceFileCache::MISS_THRESHOLD = 360

Definition at line 33 of file ResourceFileCache.php.


The documentation for this class was generated from the following file: