asp缓存类(4)
Else
..................
BoardJumpList=xxx
WydCache.Value=BoardJumpList '写入内容
Response.write BoardJumpList
End if
mycache.DelCahe("缓存名") 删除缓存
slightboy 写的 '========================
复制代码 代码如下:
'clsCache.asp
'========================
'== begin : 2004-6-26 21:51:47
'== copyright : slightboy (C)1998-2004
'== email : slightboy@msn.com
'========================
'========================
' Dim Application(2)
' Application(0) Counter 计数器
' Application(1) dateTime 放置时间
' Application(2) Content 缓存内容
Public PREFIX
Public PREFIX_LENGTH
Private Sub Class_Initialize()
PREFIX = "Cached:"
PREFIX_LENGTH = 7
End Sub
Private Sub Class_Terminate
End Sub
' 设置变量
Public Property Let Cache(ByRef Key, ByRef Content)
Dim Item(2)
Item(0) = 0
Item(1) = Now()
IF (IsObject(Content)) Then
Set Item(2) = Content
Else
Item(2) = Content
End IF
Application.Unlock
Application(PREFIX & Key) = Item
Application.Lock
End Property
' 取出变量 计数器++
Public Property Get Cache(ByRef Key)
Dim Item
Item = Application(PREFIX & Key)
IF (IsArray(Item)) Then
IF (IsObject(Item)) Then
Set Cache = Item(2)
Else
Cache = Item(2)
End IF
Application(PREFIX & Key)(0) = Application(PREFIX & Key)(0) + 1
Else
Cache = Empty
End IF
End Property
' 检查缓存对象是否存在
Public Property Get Exists(ByRef Key)
Dim Item
Item = Application(PREFIX & Key)
IF (IsArray(Item)) Then
Exists = True
Else
Exists = False
End IF
End Property
' 得到计数器数值
Public Property Get Counter(ByRef Key)
Dim Item
Item = Application(PREFIX & Key)
IF (IsArray(Item)) Then
Counter = Item(0)
End IF
End Property
' 设置计数器时间
Public Property Let dateTime(ByRef Key, ByRef SetdateTime)
Dim Item
Item = Application(PREFIX & Key)
IF (IsArray(Item)) Then
Item(1) = SetdateTime
End IF
End Property
' 得到计数器时间
内容版权声明:除非注明,否则皆为本站原创文章。