Class Cache

Description

A class to handle manipulation of cache files (or any file, really).

Located in /class.cache.php (line 23)


                
			
Method Summary
static boolean Exists (string $sCacheFileName)
Cache __construct ([string $sCacheFileName = null])
void Close ()
integer GetCreatedTime ()
integer GetModifiedTime ()
string Open (string $sCacheFileName)
void Save (string $sCacheFileName, string $sCacheContents)
string __toString ()
Methods
static method Exists (line 69)

Simply returns whether or not the supplied file path exists. There is no difference between calling this method and calling file_exists().

  • return: True if the file exists, false if not
  • access: public
static boolean Exists (string $sCacheFileName)
  • string $sCacheFileName: The absolute path to the cache file we're checking the existence of
Constructor __construct (line 51)

The constructor for the cache class. Loads the supplied cache file, if one was specified.

  • access: public
Cache __construct ([string $sCacheFileName = null])
  • string $sCacheFileName: The absolute path to the cache file to load
Close (line 145)

This method actually does not close anything as we do not keep an active connection to the file. Instead, this method simply clears all file variables and stored contents.

  • access: public
void Close ()
GetCreatedTime (line 161)

Returns the created time for the current cache file.

  • return: The timestamp for when the current file was created
  • access: public
integer GetCreatedTime ()
GetModifiedTime (line 173)

Returns the last created time for the current cache file.

  • return: The timestamp for when the current file was last modified
  • access: public
integer GetModifiedTime ()
Open (line 86)

Attempts to open a cache file. If the file does not exist, a FileNotFoundException is thrown. If the file does exist, it's contents are loaded, as well as the created and modified time for the file. This method returns the contents of the cache file.

  • return: The contents of the cache file
  • throws: FileNotFoundException
  • access: public
string Open (string $sCacheFileName)
  • string $sCacheFileName: The name of the cache file to load
Save (line 118)

Attempts to save a cache file with the specified contents. If the directory part of the supplied file name does not exist, a FileNotFoundException is thrown. If this method fails to write to the supplied file, an Exception is thrown.

On a sucessful save, this method loads information about the cache file and stores the cache contents.

  • throws: Exception
  • throws: FileNotFoundException
  • access: public
void Save (string $sCacheFileName, string $sCacheContents)
  • string $sCacheFileName: The name of the file to save the cache contents to
  • string $sCacheContents: The content to be cached in the supplied file
__toString (line 185)

The __toString() method returns the contents of the cache file

  • return: The contents of the cache file
  • access: public
string __toString ()

Documentation generated on Thu, 25 Feb 2010 15:59:39 -0500 by phpDocumentor 1.4.3