MediaWiki  REL1_19
FileCacheBase Class Reference
Inheritance diagram for FileCacheBase:

List of all members.

Public Member Functions

 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.

Public Attributes

const MISS_FACTOR = 15
const MISS_TTL_SEC = 3600

Protected Member Functions

 __construct ()
 baseCacheDirectory ()
 Get the base file cache directory.
 cacheDirectory ()
 Get the base cache directory (not specific to this file)
 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

 $mCached
 $mExt = 'cache'
 $mFilePath
 $mKey
 $mType = 'object'
 $mUseGzip

Detailed Description

Definition at line 7 of file FileCacheBase.php.


Constructor & Destructor Documentation

FileCacheBase::__construct ( ) [protected]

Definition at line 20 of file FileCacheBase.php.

References $wgUseGzip.


Member Function Documentation

FileCacheBase::baseCacheDirectory ( ) [final, protected]

Get the base file cache directory.

Returns:
string

Definition at line 30 of file FileCacheBase.php.

References $wgFileCacheDirectory.

Referenced by ObjectFileCache\cacheDirectory(), HTMLFileCache\cacheDirectory(), and ResourceFileCache\cacheDirectory().

Here is the caller graph for this function:

FileCacheBase::cacheDirectory ( ) [abstract, protected]

Get the base cache directory (not specific to this file)

Returns:
string

Reimplemented in ResourceFileCache, HTMLFileCache, and ObjectFileCache.

Referenced by cachePath().

Here is the caller graph for this function:

FileCacheBase::cacheMissKey ( ) [protected]
Returns:
string

Definition at line 249 of file FileCacheBase.php.

References wfMemcKey().

Referenced by getMissesRecent(), and incrMissesRecent().

Here is the call graph for this function:

Here is the caller graph for this function:

FileCacheBase::cachePath ( ) [protected]

Get the path to the cache file.

Returns:
string

Definition at line 45 of file FileCacheBase.php.

References $dir, cacheDirectory(), hashSubdirectory(), typeSubdirectory(), and useGzip().

Referenced by cacheTimestamp(), checkCacheDirs(), clearCache(), fetchText(), isCached(), HTMLFileCache\loadFromFileCache(), and saveText().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the last-modified timestamp of the cache file.

Returns:
string|false TS_MW timestamp

Definition at line 79 of file FileCacheBase.php.

References cachePath(), and wfTimestamp().

Referenced by isCacheGood(), and ResourceLoader\tryRespondFromFileCache().

Here is the call graph for this function:

Here is the caller graph for this function:

Create parent directors of $this->cachePath()

Returns:
void

Definition at line 168 of file FileCacheBase.php.

References cachePath(), and wfMkdirParents().

Referenced by saveText().

Here is the call graph for this function:

Here is the caller graph for this function:

Clear the cache for this page.

Returns:
void

Definition at line 157 of file FileCacheBase.php.

References cachePath(), wfRestoreWarnings(), and wfSuppressWarnings().

Here is the call graph for this function:

Get the uncompressed text from the cache.

Returns:
string

Definition at line 118 of file FileCacheBase.php.

References cachePath(), and useGzip().

Referenced by ResourceLoader\tryRespondFromFileCache().

Here is the call graph for this function:

Here is the caller graph for this function:

Roughly gets the cache misses in the last hour by unique visitors.

Returns:
int

Definition at line 241 of file FileCacheBase.php.

References $wgMemc, and cacheMissKey().

Referenced by ResourceFileCache\isCacheWorthy().

Here is the call graph for this function:

Here is the caller graph for this function:

Return relative multi-level hash subdirectory (with trailing slash) or the empty string if not $wgFileCacheDepth.

Returns:
string

Definition at line 188 of file FileCacheBase.php.

References $wgFileCacheDepth.

Referenced by cachePath().

Here is the caller graph for this function:

Roughly increments the cache misses in the last hour by unique visitors.

Parameters:
$requestWebRequest
Returns:
void

Definition at line 207 of file FileCacheBase.php.

References $wgMemc, cacheMissKey(), false, IP\isIPv6(), IP\isValid(), IP\sanitizeRange(), and wfMemcKey().

Here is the call graph for this function:

Check if the cache file exists.

Returns:
bool

Definition at line 68 of file FileCacheBase.php.

References cachePath().

Referenced by isCacheGood(), and ResourceFileCache\isCacheWorthy().

Here is the call graph for this function:

Here is the caller graph for this function:

FileCacheBase::isCacheGood ( timestamp = '')

Check if up to date cache file exists.

Parameters:
$timestampstring MW_TS timestamp
Returns:
bool

Definition at line 92 of file FileCacheBase.php.

References $wgCacheEpoch, cacheTimestamp(), isCached(), and wfDebug().

Referenced by ResourceLoader\tryRespondFromFileCache().

Here is the call graph for this function:

Here is the caller graph for this function:

Save and compress text to the cache.

Returns:
string compressed text

Definition at line 131 of file FileCacheBase.php.

References $wgUseFileCache, cachePath(), checkCacheDirs(), useGzip(), and wfDebug().

Referenced by HTMLFileCache\saveToFileCache().

Here is the call graph for this function:

Here is the caller graph for this function:

Get the cache type subdirectory (with trailing slash) An extending class could use that method to alter the type -> directory mapping.

See also:
HTMLFileCache::typeSubdirectory() for an example.
Returns:
string

Reimplemented in HTMLFileCache.

Definition at line 179 of file FileCacheBase.php.

Referenced by cachePath().

Here is the caller graph for this function:

FileCacheBase::useGzip ( ) [protected]

Check if the cache is gzipped.

Returns:
bool

Definition at line 110 of file FileCacheBase.php.

Referenced by cachePath(), fetchText(), HTMLFileCache\loadFromFileCache(), saveText(), and HTMLFileCache\saveToFileCache().

Here is the caller graph for this function:


Member Data Documentation

FileCacheBase::$mCached [protected]

Definition at line 14 of file FileCacheBase.php.

FileCacheBase::$mExt = 'cache' [protected]

Definition at line 10 of file FileCacheBase.php.

FileCacheBase::$mFilePath [protected]

Definition at line 11 of file FileCacheBase.php.

FileCacheBase::$mKey [protected]

Definition at line 8 of file FileCacheBase.php.

FileCacheBase::$mType = 'object' [protected]

Definition at line 9 of file FileCacheBase.php.

FileCacheBase::$mUseGzip [protected]

Definition at line 12 of file FileCacheBase.php.

Definition at line 17 of file FileCacheBase.php.

Definition at line 18 of file FileCacheBase.php.


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