/** * Instantiate a cache. */ function MemcacheCache($context, $cacheId, $fallback, $hostname, $port) { parent::GenericCache($context, $cacheId, $fallback); $this->connection = new Memcache(); if (!$this->connection->connect($hostname, $port)) { $this->connection = null; } $this->flag = null; $this->expire = 3600; // 1 hour default expiry }
/** * Instantiate a cache. */ function FileCache($context, $cacheId, $fallback, $path) { parent::GenericCache($context, $cacheId, $fallback); $this->filename = $path . DIRECTORY_SEPARATOR . "fc-{$context}-" . str_replace('/', '.', $cacheId) . '.php'; // Load the cache data if it exists. if (file_exists($this->filename)) { $this->cache = (include $this->filename); } else { $this->cache = null; } }
/** * Instantiate a cache. */ function FileCache($context, $cacheId, $fallback, $path) { parent::GenericCache($context, $cacheId, $fallback); $this->filename = $path . DIRECTORY_SEPARATOR . "fc-{$context}-" . str_replace('/', '.', $cacheId) . '.php'; // Load the cache data if it exists. if (($fp = @fopen($this->filename, 'r')) !== false) { flock($fp, LOCK_SH); $this->cache = (include $this->filename); flock($fp, LOCK_UN); } else { $this->cache = null; } }
/** * Instantiate a cache. */ function FileCache($context, $cacheId, $fallback, $path) { parent::GenericCache($context, $cacheId, $fallback); $this->filename = $path . DIRECTORY_SEPARATOR . "fc-{$context}-" . str_replace('/', '.', $cacheId) . '.php'; // Load the cache data if it exists. (To avoid a race condition, // we assume the file exists and suppress the potential warn.) $result = @(include $this->filename); if ($result !== false) { $this->cache = $result; } else { $this->cache = null; } }
/** * Constructor */ function GenericOrderedCache($objtype, $load_all, $tablename, $prefix = '', $dbIDname = 'ID', $name_field = NULL) { parent::GenericCache($objtype, $load_all, $tablename, $prefix, $dbIDname, $name_field); }
/** * Instantiate a cache. */ function XCacheCache($context, $cacheId, $fallback) { parent::GenericCache($context, $cacheId, $fallback); }
/** * Instantiate a cache. */ function __construct($context, $cacheId, $fallback) { parent::__construct($context, $cacheId, $fallback); }
/** * Add a dataobject to the cache */ function add(&$Obj) { global $Debuglog; if (parent::add($Obj)) { // Successfuly added if (!empty($this->subset_property)) { // Also add to subset cache: $this->subset_cache[$Obj->{$this->subset_property}][$Obj->ID] =& $Obj; } return true; } return false; }