mobile_code.auto_cache.php 606 B

123456789101112131415161718192021222324252627282930
  1. <?php
  2. class mobile_code_auto_cache extends auto_cache{
  3. private $key = "mobile_code: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,country,area_code from ".DB_PREFIX."national_telephone_code where is_effect = 1 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. ?>