<%
Class Cls_Cache
	Private Cache
	Private CacheName
	Private CacheNames
	Private ExpireTime
	Private ExpireTimeName
	' @ 初始化类
	Private Sub Class_Initialize
		' @ 缓存名称 ( 必改 )
		CacheName = "Free_"
	End Sub
	' @ 注销类
	Private Sub Class_Terminate
		
	End Sub
	'--------------------------------------------------------
	' @ 函数: 读取缓存是否有效/属性
	Public Property Get Valid
		Valid = True
		If IsEmpty(Cache) Then
			Valid = False
		End If
		If Not IsEmpty(ExpireTime) Then
			If Not IsDate(ExpireTime) Or CDate(ExpireTime)<Nowtime Then Valid = False
		End If
	End Property
	'--------------------------------------------------------
	' @ 函数: 读取当前缓存内容/属性
	Public Property Get Value
		If IsEmpty(Cache) Then
			Value = Null
		Else
			Value = Cache
		End If
	End Property
	'--------------------------------------------------------
	' @ 函数: 设置缓存名称/属性
	Public Property Let Name(Names)
		CacheNames = CacheName & Names
		Cache = Application(CacheNames)
		ExpireTimeName = Cachename & Names & "_Expire"
		ExpireTime = Application(ExpireTimeName)
	End Property
	'--------------------------------------------------------
	' @ 函数: 设置缓存过期时间/属性
	Public Property Let Expire(Times)
		Application.Lock()
		Application(ExpireTimeName) = Times
		Application.UnLock()
	End Property
	'--------------------------------------------------------
	' @ 函数: 对缓存赋值/方法
	Public Sub Add(VarCache)
		If IsEmpty(VarCache) Then
			Exit Sub
		End If
		Cache = VarCache
		Application.Lock
		Application(CacheNames) = Cache
		Application.UnLock
	End Sub
	'--------------------------------------------------------
	' @ 释放缓存/方法
	Public Sub Clear
		Application.Lock
		Application(CacheNames) = Empty
		If not IsEmpty(Application(ExpireTimeName)) Then
			Application(ExpireTimeName) = Empty
		End If
		Application.UnLock
		Cache = Empty
		ExpireTime = Empty
	End Sub
	'--------------------------------------------------------
	' @ 比较缓存值是否相同/方法——返回是或否
	Public Function Verify(varCache2)
		If TypeName(Cache)<>TypeName(varCache2) Then
			Verify = False
		ElseIf TypeName(Cache)="Object" Then
			If Cache Is varCache2 Then
				Verify = True
			Else
				Verify = False
			End If
		ElseIf TypeName(Cache) = "Variant()" Then
			If Join(Cache,"^") = Join(varCache2,"^") Then
				Verify = True
			Else
				Verify = False
			End If
		Else
			If Cache=varCache2 Then
				Verify = True
			Else
				Verify = False
			End If
		End If
	End Function
End Class
%>
