Class php_text_cache
A simple caching class for saving/retrieving local copies of url data.

isPublic? yes
isAbstract? no

Inheritance tree:


php_http_connector
|
php_text_cache

Known subclasses:

None

Source file: php_text_cache.php




Constructor
Directory in which to store the cache files.

Signature: php_text_cache($cacheDir = './', $cacheTime = -1)

isPublic? yes




Public Constants



Private Constants



Public Fields



Private Fields
cacheDir
The directory in which cached files are stored.

Type: String

cacheTime
The amount time of time to wait before a cached file should be updated.

Type: int




Public Methods



Private Methods
getData
Gets data from an url, or its cache file.

Signature: getData($url)

Parameters:

String url - The url of the data.

Returns:

String - The data at the specified url.

getCacheFileName
Given an url, returns the path to the cache file. Uses an md5 hash of the url. This can be overridden if a different approach is required.

Signature: getCacheFileName($url)

Parameters:

String url - The url of the data.

Returns:

String - The cache file name.

establishConnection
Establishes a connection, given an url.

Signature: establishConnection($url)

Parameters:

String url - The url of the data.

fromURL
Gets data from an url and caches a copy of the data.

Signature: fromURL($url, $cacheFile)

Parameters:

String url - The url of the data.

String cacheFile - The cache file path.

Returns:

String - The contents of the url.

fromCache
Get text from cache file.

Signature: fromCache($cacheFile)

Parameters:

String cacheFile - The file path.

Returns:

String - The text contained in the file, or an empty string.

fromFile
Get text from an url or file.

Signature: fromFile($filename)

Parameters:

String filename - The url or file path.

Returns:

String - The text contained in the file, or an empty string.


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