// Caching class
class CacheSystem {
- // Define variables
- var $ret = 'init';
+ // Status code
+ var $statusCode = 'init';
+
+ // Full-qualified filename
var $fqfn = '';
+
+ // Resource to cache file
var $pointer = false;
+
+ // Data array from cache
var $data = array();
+
+ // Version data from cache
var $version = array();
+
+ // Cache name
var $name = '';
var $rebuilt = array();
+
+ // File extension
var $extension = '.cache';
- var $statusDone = 'done';
var $status = array();
var $readable = array();
// Constructor
function CacheSystem () {
// Failed is the default
- $this->ret = 'failed';
+ $this->setStatusCode('failed');
// Remeber path
// Is there a .htaccess file?
if (isFileReadable(getCachePath() . '.htaccess')) {
// All done!
- $this->ret = $this->statusDone;
+ $this->setStatusCode('done');
} else {
// Stop! Set a .htaccess file first
- $this->ret = 'htaccess';
+ $this->setStatusCode('htaccess');
}
} // END - if
}
// Initializes the cache file
function init () {
// This will destory an existing cache file!
- if ($this->ret == $this->statusDone) {
+ if ($this->getStatusCode() == 'done') {
// Reset read status
$this->resetCacheReadStatus();
// Unused method:
function removeEntry ($search, $data, $array) {
- if ($this->status[$this->name] == $this->statusDone) {
+ if ($this->status[$this->name] == 'done') {
// Load cache into dummy array
$dummy = $this->getArrayFromCache();
foreach($v as $k2 => $v2) {
// Put every array element in a row...
$LINE .= $this->rewriteEntry($k, $v2);
- }
+ } // END - foreach
} else {
// Single line found
$LINE = $this->rewriteEntry($k, $v);
// Unused method
function replaceEntry ($search, $replace, $search_key, $array) {
- if ($this->status[$this->name] == $this->statusDone) {
+ if ($this->status[$this->name] == 'done') {
// Load cache into dummy array
$dummy = $this->getArrayFromCache();
return $line;
}
- // Getter for cache status
- function getStatus () {
- return $this->ret;
+ // Getter for cache status code
+ function getStatusCode () {
+ return $this->statusCode;
+ }
+
+ // Setter for cache status code
+ function setStatusCode ($status) {
+ $this->statusCode = $status;
}
// Checks wether the current cache file is readable