MediaWiki  1.27.2
HTMLFileCache Class Reference

Page view caching in the file system. More...

Inheritance diagram for HTMLFileCache:
Collaboration diagram for HTMLFileCache:

Public Member Functions

 __construct ($title, $action)
 
 loadFromFileCache (IContextSource $context)
 Read from cache to context output. More...
 
 saveToFileCache ($text)
 Save this cache object with the given text. More...
 
- Public Member Functions inherited from FileCacheBase
 cacheTimestamp ()
 Get the last-modified timestamp of the cache file. More...
 
 clearCache ()
 Clear the cache for this page. More...
 
 fetchText ()
 Get the uncompressed text from the cache. More...
 
 getMissesRecent ()
 Roughly gets the cache misses in the last hour by unique visitors. More...
 
 incrMissesRecent (WebRequest $request)
 Roughly increments the cache misses in the last hour by unique visitors. More...
 
 isCached ()
 Check if the cache file exists. More...
 
 isCacheGood ($timestamp= '')
 Check if up to date cache file exists. More...
 
 saveText ($text)
 Save and compress text to the cache. More...
 

Static Public Member Functions

static clearFileCache (Title $title)
 Clear the file caches for a page for all actions. More...
 
static newFromTitle ($title, $action)
 Construct an ObjectFileCache from a Title and an action. More...
 
static useFileCache (IContextSource $context)
 Check if pages can be cached for this request/user. More...
 

Protected Member Functions

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

Static Protected Member Functions

static cacheablePageActions ()
 Cacheable actions. More...
 

Additional Inherited Members

- Public Attributes inherited from FileCacheBase
const MISS_FACTOR = 15
 
const MISS_TTL_SEC = 3600
 
- Protected Attributes inherited from FileCacheBase
 $mCached
 
 $mExt = 'cache'
 
 $mFilePath
 
 $mKey
 
 $mType = 'object'
 
 $mUseGzip
 

Detailed Description

Page view caching in the file system.

The only cacheable actions are "view" and "history". Also special pages will not be cached.

Definition at line 31 of file HTMLFileCache.php.

Constructor & Destructor Documentation

HTMLFileCache::__construct (   $title,
  $action 
)
Parameters
Title | string$titleTitle object or prefixed DB key string
string$action
Exceptions
MWException

Definition at line 50 of file HTMLFileCache.php.

References $title, and string.

Member Function Documentation

static HTMLFileCache::cacheablePageActions ( )
staticprotected

Cacheable actions.

Returns
array

Definition at line 67 of file HTMLFileCache.php.

HTMLFileCache::cacheDirectory ( )
protected

Get the base file cache directory.

Returns
string

Definition at line 75 of file HTMLFileCache.php.

References FileCacheBase\baseCacheDirectory().

static HTMLFileCache::clearFileCache ( Title  $title)
static

Clear the file caches for a page for all actions.

Parameters
Title$title
Returns
bool Whether $wgUseFileCache is enabled

Definition at line 218 of file HTMLFileCache.php.

References $title, $type, $wgUseFileCache, as, and global.

Referenced by HTMLCacheUpdateJob\invalidateTitles(), WikiPage\onArticleDelete(), and WikiPage\onArticleEdit().

HTMLFileCache::loadFromFileCache ( IContextSource  $context)

Read from cache to context output.

Parameters
IContextSource$context
Returns
void

Definition at line 143 of file HTMLFileCache.php.

References $wgLanguageCode, $wgMimeType, FileCacheBase\cachePath(), IContextSource\getOutput(), global, FileCacheBase\useGzip(), wfClientAcceptsGzip(), and wfDebug().

static HTMLFileCache::newFromTitle (   $title,
  $action 
)
static

Construct an ObjectFileCache from a Title and an action.

Parameters
Title | string$titleTitle object or prefixed DB key string
string$action
Exceptions
MWException
Returns
HTMLFileCache
Deprecated:
Since 1.24, instantiate this class directly

Definition at line 41 of file HTMLFileCache.php.

References $title.

Referenced by RebuildFileCache\execute().

HTMLFileCache::saveToFileCache (   $text)

Save this cache object with the given text.

Use this as an ob_start() handler.

Parameters
string$text
Returns
bool Whether $wgUseFileCache is enabled

Definition at line 173 of file HTMLFileCache.php.

References $wgUseFileCache, global, FileCacheBase\saveText(), FileCacheBase\useGzip(), wfClientAcceptsGzip(), wfDebug(), and wfTimestampNow().

HTMLFileCache::typeSubdirectory ( )
protected

Get the cache type subdirectory (with the trailing slash) or the empty string Alter the type -> directory mapping to put action=view cache at the root.

Returns
string

Definition at line 85 of file HTMLFileCache.php.

static HTMLFileCache::useFileCache ( IContextSource  $context)
static

Check if pages can be cached for this request/user.

Parameters
IContextSource$context
Returns
bool

Definition at line 98 of file HTMLFileCache.php.

References $query, $user, $wgContLang, $wgUseFileCache, as, IContextSource\getLanguage(), IContextSource\getRequest(), IContextSource\getUser(), global, Hooks\run(), and wfDebug().

Referenced by Article\isFileCacheable(), MediaWiki\main(), and HistoryAction\onView().


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