/** * this function gets our data from the cache. no need to override */ public function getCache() { return CacheBot::get($this->getCacheKey(), 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; }