/** * this function saves our data to the cache. no need to override */ public function setCache() { CacheBot::set($this->getCacheKey(), $this->getDataToCache(), self::$objectCacheLife); }
public function getRow($sql, $key = null, $life = null) { //check the cache first? if ($key !== null && $life !== null) { $data = CacheBot::get($key, $data, $life); if (is_array($data)) { return $data; } } $this->ping(); //okay, load it from db. $data = mysql_fetch_assoc($this->query($sql)); //error? if (mysql_error()) { trigger_error(mysql_error() . ": {$sql}"); } //save it to cache? if ($key !== null && $life !== null) { CacheBot::set($key, $data, $life); } return $data; }