agid])) { foreach ($g_flag_thread[$flagid] as &$val) { flag_thread_filter($val); } flag_thread_set($flagid, $g_flag_thread[$flagid]); } } return $g_flag_thread[$flagid]; } // 设置缓存 $key = flagid / $val = flagid下tid数组 function flag_thread_set($key, $val) { global $g_flag_thread; FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread'); empty($g_flag_thread) and $g_flag_thread = array(); $g_flag_thread[$key] = $val; return website_set('flag_thread', $g_flag_thread); } // 删除flag下tid缓存 function flag_thread_delete_cache($flagid) { global $g_flag_thread; FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread'); empty($g_flag_thread) and $g_flag_thread = array(); if (isset($g_flag_thread[$flagid])) { unset($g_flag_thread[$flagid]); website_set('flag_thread', $g_flag_thread); } return TRUE; } // Delete by tid / 通过tid删除flag下的主题和对应flagid缓存 function flag_thread_delete_by_tid($tid) { global $g_flag_thread; FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread'); if (empty($g_flag_thread)) { $g_flag_thread = array(); } else { $thread = well_thread_read_cache($tid); $arrlist = flag_thread_find($tid, 1, $thread['flags']); $flagarr = $ids = array(); foreach ($arrlist as $val) { $flagarr[] = $val['flagid']; $ids[] = $val['id']; if (isset($g_flag_thread[$val['flagid']])) unset($g_flag_thread[$val['flagid']]); } website_set('flag_thread', $g_flag_thread); // 主键更新 flag_update($flagarr, array('count-' => 1)); // 主键删除 flag_thread_delete($ids); } return TRUE; } // 主键删除 通过$flagid删除flag下的主题和对应flagid缓存 function flag_thread_delete_by_flagid($flagid) { global $g_flag_thread; FALSE === $g_flag_thread and $g_flag_thread = website_get('flag_thread'); $read = flag_read_cache($flagid); if (empty($read)) return TRUE; $arrlist = flag_thread_find_by_flagid($flagid, 1, $read['count']); if (empty($arrlist)) return TRUE; $flagarr = $ids = array(); $n = 0; foreach ($arrlist as $val) { ++$n; $flagarr[] = $val['flagid']; $ids[] = $val['id']; if (isset($g_flag_thread[$flagid])) unset($g_flag_thread[$flagid]); } website_set('flag_thread', $g_flag_thread); // 主键更新 flag_update($flagarr, array('count-' => $n)); // 主键删除 $r = flag_thread_delete($ids); return $r; } ?>系统怎么重装