Class DOMIT_Cache
A lightweight class that can be used for saving a cached version of a DOMIT_Document. This significantly increases the speed at which that DOMIT_Document can be reinvoked. Note that this class does not support file locking, setting expiration dates, or any more advanced caching feature. This is a static class.

isPublic? yes
isAbstract? no

Inheritance tree:

DOMIT_Cache (top level class)

Known subclasses:

None

Source file: xml_domit_cache.php




Constructor



Public Constants
DOMIT_FILE_EXTENSION_CACHE
The extension for a DOMIT_Cache file.

Type: String

Value: dch




Private Constants



Public Fields



Private Fields



Public Methods
toCache
Writes the current DOMIT_Document to the filesystem, based on the specified xml filename. The cache files have a '.dch' extension.

Signature: toCache($xmlFileName, &$doc, $writeAttributes = "wb")

Parameters:

String xmlFileName - A file name for the cached file. Any extensions will be stripped and a '.dch' extension added.

DOMIT_Document doc - The DOMIT_Document that is to be cached.

String writeAttributes - The write attributes for the cached file. Default is 'w'

Returns:

boolean - True if the write operation is successful.

Example:

Caches the current DOMIT_Document.

$success = DOMIT_Cache::toCache("myCachedDoc.xml", $xmldoc);

fromCache
Retrieves the specified DOMIT_Document from the filesystem, based on the specified xml filename.

Signature: &fromCache($xmlFileName)

Parameters:

String xmlFileName - A file name for the cached file to be retrieved. Any extensions will be stripped and a '.dch' extension added.

Returns:

DOMIT_Document - A copy of the retrieved DOMIT_Document.

Example:

Retrieves the DOMIT_Document from the cache.

$xmldoc =& DOMIT_Cache::fromCache("myCachedDoc.xml");

cacheExists
Determines whether the specified cache file exists.

Signature: cacheExists($xmlFileName)

Parameters:

String xmlFileName - A file name for the cached file to be retrieved. Any extensions will be stripped and a '.dch' extension added.

Returns:

boolean - True if the specified cache file exists.

Example:

Retrieves the DOMIT_Document from the cache.

$xmldoc =& DOMIT_Cache::fromCache("myCachedDoc.xml");

removeFromCache
Removes the specified cache file from the file system.

Signature: removeFromCache($xmlFileName)

Parameters:

String xmlFileName - A file name for the cached file to be removed. Any extensions will be stripped and a '.dch' extension added.

Returns:

boolean - True if the specified cache file was removed.

Example:

Removes the DOMIT_Document from the cache.

$success = DOMIT_Cache::removeFromCache("myCachedDoc.xml");




Private Methods

Documentation generated by ClassyDoc, using the DOMIT! and SAXY parsers.
Please visit Engage Interactive to download free copies.