article_cates_bs.auto_cache.php 1.2 KB

1234567891011121314151617181920212223242526272829303132333435
  1. <?php
  2. //底部文章
  3. class article_cates_bs_auto_cache extends auto_cache{
  4. public function load($param,$is_real)
  5. {
  6. $param=array();
  7. $key = $this->build_key(__CLASS__,$param);
  8. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  9. $article_cates = $GLOBALS['cache']->get($key);
  10. if($article_cates === false||!$is_real)
  11. {
  12. $article_cates = $GLOBALS['db']->getAll("select * from ".DB_PREFIX."article_cate where is_effect=1 and is_delete=0 order by sort asc");
  13. $article_cates_array=array();
  14. foreach($article_cates as $k=>$v){
  15. $article_cates_array[$v['seo_title']]=$v['id'];
  16. }
  17. $article_cates=$article_cates_array;
  18. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  19. $GLOBALS['cache']->set($key,$article_cates);
  20. }
  21. return $article_cates;
  22. }
  23. public function rm($param)
  24. {
  25. $key = $this->build_key(__CLASS__,$param);
  26. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  27. $GLOBALS['cache']->rm($key);
  28. }
  29. public function clear_all()
  30. {
  31. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  32. $GLOBALS['cache']->clear();
  33. }
  34. }
  35. ?>