edu_deal_support_users.auto_cache.php 963 B

123456789101112131415161718192021222324252627282930313233343536373839404142434445
  1. <?php
  2. class edu_deal_support_users_auto_cache extends auto_cache{
  3. private $key = "edu:deal:support:users:";
  4. public function load($params = array(), $is_real)
  5. {
  6. $this->key .= md5(serialize($param));
  7. $list = $GLOBALS['cache']->get($this->key);
  8. $key_bf = $this->key . '_bf';
  9. if ($list === false || !$is_real) {
  10. $is_ok = $GLOBALS['cache']->set_lock($this->key);
  11. if(!$is_ok){
  12. $list = $GLOBALS['cache']->get($key_bf,true);
  13. }else{
  14. $deal_id=intval($params['deal_id']);
  15. $sql = "select u.id,u.nick_name from ".DB_PREFIX."user as u where order by id asc";
  16. $GLOBALS['cache']->set($this->key, $list, 3600, true);
  17. $GLOBALS['cache']->set($key_bf, $list, 86400, true);//备份
  18. //echo $this->key;
  19. }
  20. }
  21. return $list;
  22. }
  23. public function rm($param)
  24. {
  25. $GLOBALS['cache']->rm($this->key);
  26. }
  27. public function clear_all()
  28. {
  29. $GLOBALS['cache']->rm($this->key);
  30. }
  31. }
  32. ?>