public function save(array $data) { if (apc_add(parent::getName(), serialize($data), parent::getTimeToLive()) === false) { # logging me hearties # logging me hearties $types = parent::getTypes(); $urgency = parent::getUrgency(); parent::writeLog($types['error'], $urgency['high'], 'Could not successfully save to cache', 'APC Cache info: ' . PHP_EOL . serialize(apc_cache_info())); return false; } return true; }
public function load() { if ($this->__testForApc() === false) { return false; } if (($data = apc_fetch(parent::getName())) === false) { # logging me hearties $types = parent::getTypes(); $urgency = parent::getUrgency(); parent::writeLog($types['notice'], array_key_exists("low", $urgency) ? $urgency["low"] : "", 'Could not successfully read from cache', 'APC Cache info: ' . PHP_EOL . serialize(apc_cache_info())); return false; } return unserialize($data); }
private function _testForCacheDateTable() { $query = (string) "describe `cache_query_times`;"; if (self::query($query, false) === false) { $query = (string) "create table `cache_query_times` (\n\t\t\t\t`id` integer(100) unsigned not null auto_increment primary key,\n\t\t\t\t`table` char(200),\n\t\t\t\t`timestamp` integer(100) unsigned not null default 0,\n\t\t\t\tindex `cacheQueryTimes` (`table`(100), `timestamp`)\n\t\t\t) engine=InnoDb default charset=UTF8;"; if (self::query($query, false) === false) { # logging me hearties $types = parent::getTypes(); $urgency = parent::getUrgency(); parent::writeLog($types['error'], $urgency['high'], 'Could not successfully create table for cache timing', "mySQL returned the following error: " . self::getConnection()->real_escape_string(self::getConnection()->error) . "\n"); return false; } return true; } return true; }