/** * set our cache object. * * @param $bot a class extended form EasyCache that implements basic caching. */ public static function setBot($bot, $prefix = '') { if ($bot instanceof EasyCache) { self::$bot = $bot; } else { throw new Exception('Cachebots must be a derivitive of EasyCache'); } }
public function bustCache() { CacheBot::delete("{$this->key}.map"); }
but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU General Public License for more details. You should have received a copy of the GNU General Public License along with BotQueue. If not, see <http://www.gnu.org/licenses/>. */ error_reporting(E_ALL ^ E_NOTICE); define("FORCE_SSL", false); define("COMPANY_NAME", "BotQueue"); define("IS_DEV_SITE", true); define("SITE_HOSTNAME", "botqueue.com"); define("RR_PROJECT_NAME", "BotQueue"); define("RR_DB_HOST", "localhost"); define("RR_DB_PORT", "3306"); define("RR_DB_USER", "root"); define("RR_DB_PASS", ""); define("RR_DB_NAME", "BotQueue"); define("AMAZON_AWS_KEY", ""); define("AMAZON_AWS_SECRET", ""); define("AMAZON_S3_BUCKET_NAME", "botqueue"); define("EMAIL_USERNAME", "*****@*****.**"); define("EMAIL_NAME", "BotQueue"); define("EMAIL_PASSWORD", ""); define("EMAIL_SMTP_SERVER", "smtp.gmail.com"); define("EMAIL_SMTP_SERVER_PORT", 465); define('TRACK_SQL_QUERIES', false); define('TRACK_CACHE_HITS', false); //CacheBot::setBot(new EasyDBCache()); CacheBot::setBot(new NoCache());
/** * this function deletes our data from the cache. no need to override */ public function deleteCache() { CacheBot::delete($this->getCacheKey()); }
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; }