asp提高首页性能的一个技巧(3)
Rem = 函数:ObjIsEmpty()判断当前缓存是否过期。 =
Rem = 方法:DelCahe(MyCaheName)手工删除一个缓存对象,参数是缓存对象的名称。 =
Rem ================================================================
Public Reloadtime,MaxCount,CacheName
Private LocalCacheName,CacheData,DelCount
Private Sub Class_Initialize()
Reloadtime=14400
CacheName="Dvbbs"
End Sub
Private Sub SetCache(SetName,NewValue)
Application.Lock
Application(SetName) = NewValue
Application.unLock
End Sub
Private Sub makeEmpty(SetName)
Application.Lock
Application(SetName) = Empty
Application.unLock
End Sub
Public Property Let Name(ByVal vNewValue)
LocalCacheName=LCase(vNewValue)
End Property
Public Property Let Value(ByVal vNewValue)
If LocalCacheName<>"" Then
CacheData=Application(CacheName&"_"&LocalCacheName)
If IsArray(CacheData) Then
CacheData(0)=vNewValue
CacheData(1)=Now()
Else
ReDim CacheData(2)
CacheData(0)=vNewValue
CacheData(1)=Now()
End If
SetCache CacheName&"_"&LocalCacheName,CacheData
Else
Err.Raise vbObjectError + 1, "DvbbsCacheServer", " please change the CacheName."
End If
End Property
Public Property Get Value()
If LocalCacheName<>"" Then
CacheData=Application(CacheName&"_"&LocalCacheName)
If IsArray(CacheData) Then
内容版权声明:除非注明,否则皆为本站原创文章。