index_image.auto_cache.php 1.1 KB

123456789101112131415161718192021222324252627282930313233343536373839
  1. <?php
  2. //底部文章
  3. class index_image_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. $index_image = $GLOBALS['cache']->get($key);
  10. if($index_image === false||!$is_real)
  11. {
  12. $index_image_array=array();
  13. $index_image = $GLOBALS['db']->getAll("select image from ".DB_PREFIX."index_image order by sort asc");
  14. foreach($index_image as $k=>$v){
  15. $index_image_array[$k] = add_domain_url($v['image']);
  16. }
  17. $index_image=$index_image_array;
  18. $GLOBALS['cache']->set_dir(APP_ROOT_PATH."public/runtime/data/".__CLASS__."/");
  19. $GLOBALS['cache']->set($key,$index_image);
  20. }
  21. return $index_image;
  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. ?>