Class php_text_cache

Description

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

Located in /includes/domit/php_text_cache.php (line 25)

php_http_connector
   |
   --php_text_cache
Variable Summary
string $cacheDir
Method Summary
php_text_cache php_text_cache ([string $cacheDir = './'], [int $cacheTime = -1])
void establishConnection (string $url)
string fromCache (string $cacheFile)
string fromFile (string $filename)
string fromURL (string $url, string $cacheFile)
string getCacheFileName (string $url)
string getData (string $url)
Variables
string $cacheDir (line 27)
  • var: The directory in which cached files are stored
int $cacheTime (line 29)
  • var: The amount time of time to wait before a cached file should be updated

Inherited Variables

Inherited from php_http_connector

php_http_connector::$httpConnection
Methods
Constructor php_text_cache (line 36)

Constructor

php_text_cache php_text_cache ([string $cacheDir = './'], [int $cacheTime = -1])
  • string $cacheDir: Directory in which to store the cache files
  • int $cacheTime: Expiry time for cache file (-1 signifies no expiry limit)
establishConnection (line 85)

Establishes a connection, given an url

void establishConnection (string $url)
  • string $url: The url of the data
fromCache (line 132)

Get text from cache file

  • return: The text contained in the file, or an empty string
string fromCache (string $cacheFile)
  • string $cacheFile: The file path
fromFile (line 141)

Get text from an url or file

  • return: The text contained in the url or file, or an empty string
string fromFile (string $filename)
  • string $filename: The url or file path
fromURL (line 100)

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

  • return: The contents of the url
string fromURL (string $url, string $cacheFile)
  • string $url: The url for the data
  • string $cacheFile: The cache file path
getCacheFileName (line 77)

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

  • return: The cache file name
string getCacheFileName (string $url)
  • string $url: The url of the data
getData (line 48)

Gets data from an url, or its cache file

  • return: The data at the specified url
string getData (string $url)
  • string $url: The url of the data

Inherited Methods

Inherited From php_http_connector

php_http_connector::setAuthorization()
php_http_connector::setConnection()
php_http_connector::setProxyAuthorization()
php_http_connector::setProxyConnection()

Documentation generated on Fri, 4 Mar 2005 13:57:09 +1000 by phpDocumentor 1.3.0RC3