Source for file DiskCache.php
Documentation is available at DiskCache.php
* @package php-lastfm-api
* @author Felix Bruns <felixbruns@web.de>
/** The directory where the cache data is stored.
/** Constructor that sets up the DiskCache.
* @param string $directory The directory to use. (Optional)
$this->directory =
$directory;
@mkdir($this->directory);
if(!is_dir($this->directory)){
$this->directory =
dirname($this->directory);
/** Checks if data associated with a hash exists in the cache.
* @param string $hash The hash of the entry to be checked.
* @return boolean true if the entry exists, otherwise false.
/** Loads data from the cache.
* @param string $hash The hash of the entry to be loaded.
* @return string The cached data.
public function load($hash){
/** Removes data from the cache.
* @param string $hash The hash of the entry to be removed.
public function remove($hash){
@unlink($this->directory.
'/'.
$hash.
'.xml');
@unlink($this->directory.
'/'.
$hash.
'.meta');
/** Stores data in the cache.
* @param string $hash The hash of the data to be stored.
* @param string $data The data to be stored.
* @param string $expiration The expiration time of the data (unix timestamp).
public function store($hash, $data, $expiration){
/** Removes all data from the cache.
@rmdir($this->directory);
@mkdir($this->directory);
/** Checks if data associated with a hash is expired.
* @param string $hash The hash of the entry to be checked.
* @return boolean true if the entry is expired, otherwise false.
Documentation generated on Mon, 22 Dec 2008 16:57:35 +0100 by phpDocumentor 1.4.1