article_notice.auto_cache.php 915 B

1234567891011121314151617181920212223242526272829303132333435363738394041
  1. <?php
  2. class article_notice_auto_cache extends auto_cache{
  3. private $key = "article:notice";
  4. public function load($param)
  5. {
  6. $listmsg = $GLOBALS['cache']->get($this->key);
  7. if($listmsg === false)
  8. {
  9. $affiche_sql = "select a.id,a.title,a.content from ".DB_PREFIX."article as a left join ".DB_PREFIX."article_cate as ac on ac.id = a.cate_id where a.is_delete = 0 and a.is_effect = 1 and ac.type_id = 2 ";
  10. $affiche = $GLOBALS['db']->getAll($affiche_sql,true,true);
  11. $listmsg = array();
  12. foreach ( $affiche as $k => $v )
  13. {
  14. $msg = array();
  15. $msg['type'] = 9;
  16. $msg['fonts_color'] = '';
  17. $msg['desc'] = $v['content'];
  18. $listmsg[] = $msg;
  19. }
  20. $GLOBALS['cache']->set($this->key,$listmsg);
  21. }
  22. return $listmsg;
  23. }
  24. public function rm($param)
  25. {
  26. $GLOBALS['cache']->rm($this->key);
  27. }
  28. public function clear_all()
  29. {
  30. $GLOBALS['cache']->rm($this->key);
  31. }
  32. }
  33. ?>