cache
来自「WAP手机网页XXXXX WAP手机网页XXXXX」· 代码 · 共 46 行
TXT
46 行
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
⌨️ 快捷键说明
复制代码Ctrl + C
搜索代码Ctrl + F
全屏模式F11
增大字号Ctrl + =
减小字号Ctrl + -
显示快捷键?