FileCache Class Reference
[FileRepo]

Cache of file objects, wrapping some RepoGroup functions to avoid redundant queries. More...

List of all members.

Public Member Functions

 __construct ($repoGroup)
 Construct a group of file repositories.
 addFiles ($files)
 Add some files to the cache.
 clearFiles ($remove)
 Remove some files from the cache, so that their existence will be rechecked.
 markNotFound ($dbkeys)
 Mark some DB keys as nonexistent.
 findFile ($title)
 Search the cache for a file.
 findFiles ($titles)
 Search the cache for multiple files.

Static Public Member Functions

static singleton ()
 Get a FileCache instance.
static destroySingleton ()
 Destroy the singleton instance, so that a new one will be created next time singleton() is called.
static setSingleton ($instance)
 Set the singleton instance to a given object.

Public Attributes

 $repoGroup
 $cache = array()
 $notFound = array()

Static Protected Attributes

static $instance


Detailed Description

Cache of file objects, wrapping some RepoGroup functions to avoid redundant queries.

Loosely inspired by the LinkCache / LinkBatch classes for titles.

ISSUE: Merge with RepoGroup?

Definition at line 10 of file FileCache.php.


Constructor & Destructor Documentation

FileCache::__construct ( repoGroup  ) 

Construct a group of file repositories.

Parameters:
RepoGroup $repoGroup

Definition at line 47 of file FileCache.php.

References $repoGroup.


Member Function Documentation

FileCache::addFiles ( files  ) 

Add some files to the cache.

This is a fairly low-level function, which most users should not need to call. Note that any existing entries for the same keys will not be replaced. Call clearFiles() first if you need that.

Parameters:
array $files array of File objects, indexed by DB key

Definition at line 59 of file FileCache.php.

References $files, and wfDebug().

Referenced by findFiles().

FileCache::clearFiles ( remove  ) 

Remove some files from the cache, so that their existence will be rechecked.

This is a fairly low-level function, which most users should not need to call.

Parameters:
array $remove array indexed by DB keys to remove (the values are ignored)

Definition at line 70 of file FileCache.php.

References wfDebug().

static FileCache::destroySingleton (  )  [static]

Destroy the singleton instance, so that a new one will be created next time singleton() is called.

Definition at line 32 of file FileCache.php.

Referenced by ParserTest::teardownGlobals().

FileCache::findFile ( title  ) 

Search the cache for a file.

Parameters:
mixed $title Title object or string
Returns:
File object or false if it is not found
Todo:
Implement searching for old file versions(?)

Definition at line 93 of file FileCache.php.

References $file, $title, Title::makeTitleSafe(), and wfDebug().

FileCache::findFiles ( titles  ) 

Search the cache for multiple files.

Parameters:
array $titles Title objects or strings to search for
Returns:
array of File objects, indexed by DB key

Definition at line 128 of file FileCache.php.

References $result, $title, addFiles(), Title::makeTitleSafe(), markNotFound(), and wfDebug().

FileCache::markNotFound ( dbkeys  ) 

Mark some DB keys as nonexistent.

This is a fairly low-level function, which most users should not need to call.

Parameters:
array $dbkeys array of DB keys

Definition at line 81 of file FileCache.php.

References wfDebug().

Referenced by findFiles().

static FileCache::setSingleton ( instance  )  [static]

Set the singleton instance to a given object.

Definition at line 39 of file FileCache.php.

References $instance.

static FileCache::singleton (  )  [static]

Get a FileCache instance.

Typically, only one instance of FileCache is needed in a MediaWiki invocation.

Definition at line 20 of file FileCache.php.

References RepoGroup::singleton().

Referenced by wfFindFile().


Member Data Documentation

FileCache::$cache = array()

Definition at line 12 of file FileCache.php.

FileCache::$instance [static, protected]

Definition at line 14 of file FileCache.php.

Referenced by setSingleton().

FileCache::$notFound = array()

Definition at line 12 of file FileCache.php.

FileCache::$repoGroup

Definition at line 11 of file FileCache.php.

Referenced by __construct().


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

Generated on Sat Sep 5 02:08:37 2009 for MediaWiki by  doxygen 1.5.9