region_list.auto_cache.php 541 B

1234567891011121314151617181920212223242526272829
  1. <?php
  2. class region_list_auto_cache extends auto_cache{
  3. private $key = "region:list";
  4. public function load($param)
  5. {
  6. $list = $GLOBALS['cache']->get($this->key);
  7. if($list === false)
  8. {
  9. $sql = "select id,pid,name,region_level from ".DB_PREFIX."region_conf";
  10. $list = $GLOBALS['db']->getAll($sql,true,true);
  11. $GLOBALS['cache']->set($this->key,$list);
  12. }
  13. return $list;
  14. }
  15. public function rm($param)
  16. {
  17. $GLOBALS['cache']->rm($this->key);
  18. }
  19. public function clear_all()
  20. {
  21. $GLOBALS['cache']->rm($this->key);
  22. }
  23. }
  24. ?>