📄 cache.asp
字号:
<%
Class ImplMocomUtilCache
Public Expires
Private Function getCacheName(ByVal strName)
getCacheName = Replace(Replace("VBS.Cache.$(Name)", "$(Name)", strName), ".", "_")
End Function
Public Default Property Get Item(ByVal strName)
Dim strCache
strCache = getCacheName(strName)
If Not IsEmpty(Application(strCache)) Then
Expires = Application(strCache & "_Expires")
If DateDiff("s", Expires, Now()) < 0 Then'未超时
If IsObject(Application(strCache)) Then
Set Item = Application(strCache)
Else
Item = Application(strCache)
End If
End If
End If
End Property
Public Property Let Item(ByVal strName, vtIn)
Dim strCache
strCache = getCacheName(strName)
Application.Lock
If IsObject(vtIn) Then
Set Application(strCache) = vtIn
Else
Application(strCache) = vtIn
End If
Application(strCache & "_Expires") = Expires
Application.Unlock
End Property
Public Sub Remove(ByVal strName)
Dim strCache
strCache = getCacheName(strName)
Application.Lock
If IsObject(Application(strCache)) Then
Set Application(strCache) = Nothing
End If
Application(strCache) = Empty
Application(strCache & "_Expires") = Empty
Application.Unlock
End Sub
Public Function newInstance()
Set newInstance = New ImplMocomUtilCache
End Function
End Class
%>
⌨️ 快捷键说明
复制代码
Ctrl + C
搜索代码
Ctrl + F
全屏模式
F11
切换主题
Ctrl + Shift + D
显示快捷键
?
增大字号
Ctrl + =
减小字号
Ctrl + -