<!--#include file="../conn.asp"-->
<!--#include file="setup.asp"-->
<!--#include file="inc/const.asp"-->
<!--#include file="inc/check.asp"-->
<%
Admin_header
Response.Write "<table border=""0"" align=""center"" cellpadding=""3"" cellspacing=""1"" class=""tableborder"">" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "	<th>更新站点缓存</th>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "	<td class=""tablerow1"">&nbsp;&nbsp;<b>开始执行清理当前站点缓存</b></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "<tr>" & vbCrLf
Response.Write "	<td class=""tablerow2""><ol id=""CacheInfo""></ol></td>" & vbCrLf
Response.Write "</tr>" & vbCrLf
Response.Write "</table>" & vbCrLf
Response.Write "<script language=""JavaScript"">var e=document.getElementById(""CacheInfo"");</script>" & vbCrLf
Response.Flush

Dim CacheName
CacheName=NewAsp.CacheName
Call RemoveAllCache()
Admin_footer
NewAsp.PageEnd

Function  GetallCache()
	Dim Cacheobj
	For Each Cacheobj in Application.Contents
	If CStr(Left(Cacheobj,Len(CacheName)+1))=CStr(CacheName&"_") Then
		GetallCache=GetallCache&Cacheobj&","
	End If
	Next
End Function

Sub RemoveAllCache()
	Dim Cachelist,i
	Cachelist=Split(GetallCache(),",")
	If UBound(Cachelist)>0 Then
		For i=0 To UBound(Cachelist)-1
			RemoveCache Cachelist(i)
			Call InnerHtml("更新 <b>"& Replace(Cachelist(i),CacheName&"_","") &"</b> 完成")
		Next
		Call InnerHtml("共更新了 <b>"& UBound(Cachelist) &"</b> 个缓存对象")
	Else
		Call InnerHtml("<b>当前站点缓存全部清理完成。</b>。")
	End If
End Sub

Sub RemoveCache(MyCaheName)
	Application.Lock
	Application.Contents.Remove(MyCaheName)
	Application.unLock
End Sub

Sub InnerHtml(msg)
	Response.Write "<script language=""JavaScript"">e.innerHTML += ""<li>"&msg&"</li>"";</script>" & vbCrLf
	Response.Flush
End Sub

Sub RemoveAllLabelCache(chanid)
	Dim objCache,strCacheName
	Dim strCachelist,Cachelist,i
	Select Case chanid
		Case 1 : strCacheName=NewAsp.CacheName&"_newslist"
		Case 2 : strCacheName=NewAsp.CacheName&"_softlist"
		Case 3 : strCacheName=NewAsp.CacheName&"_shoplist"
		Case 4 : strCacheName=NewAsp.CacheName&"_imagelist"
		Case 5 : strCacheName=NewAsp.CacheName&"_flashlist"
	Case Else
		strCacheName=NewAsp.CacheName&"_custom"
	End Select

	For Each objCache in Application.Contents
		If CStr(Left(objCache,Len(strCacheName)+1))=CStr(strCacheName&"_") Then
			strCachelist=strCachelist&objCache&","
		End If
	Next

	Cachelist=Split(strCachelist,",")
	If UBound(Cachelist)>0 Then
		For i=0 To UBound(Cachelist)-1
			Application.Lock
			Application.Contents.Remove(Cachelist(i))
			Application.unLock
			Call InnerHtml("更新 <b>"& Cachelist(i) &"</b> 完成")
		Next
		Call InnerHtml("共更新了 <b>"& UBound(Cachelist) &"</b> 个缓存对象")
	Else
		Call InnerHtml("<b>当前频道标签缓存全部清理完成。</b>。")
	End If
End Sub
%>