rule_list.auto_cache.php 662 B

12345678910111213141516171819202122232425262728293031
  1. <?php
  2. class rule_list_auto_cache extends auto_cache{
  3. private $key = "rule:list";
  4. public function load($param)
  5. {
  6. $list = $GLOBALS['cache']->get($this->key);
  7. if($list === false)
  8. {
  9. //unserialize(
  10. $sql = "select id,name,money,(diamonds + gift_diamonds) as diamonds,gift_coins,iap_money from ".DB_PREFIX."recharge_rule where is_effect = 1 and is_delete = 0 order by sort";
  11. $list = $GLOBALS['db']->getAll($sql,true,true);
  12. $GLOBALS['cache']->set($this->key,$list);
  13. }
  14. return $list;
  15. }
  16. public function rm($param)
  17. {
  18. $GLOBALS['cache']->rm($this->key);
  19. }
  20. public function clear_all()
  21. {
  22. $GLOBALS['cache']->rm($this->key);
  23. }
  24. }
  25. ?>