CacheCls缓存的应用(2)



    Public Property Get Value()
        If LocalCacheName<>"" Then     
            If IsArray(Cache_Data) Then
                Value=Cache_Data
            End If
        Else
            Response.Write "设置缓存出错,或缓存名不能为空,请重新更新缓存"
            Response.End()
        End If
    End Property

    '取指定缓存中的值
    Public Function GetCacheValue(MyCaheName)
        GetCacheValue = Application(CacheName & "_" & MyCaheName)
    End Function

    '取所有缓存名
    Public Function GetallCacheName()
        Dim Cacheobj
        For Each Cacheobj in Application.Contents
            GetallCacheName = GetallCacheName & Cacheobj & ","
        Next
        GetallCacheName = Left(GetallCacheName,Len(GetallCacheName)-1)
        GetallCacheName = Replace(GetallCacheName,CacheName & "_","")
    End Function

    '释放缓存    
    Public Sub DelCahe(MyCaheName)
        Application.Lock
        Application.Contents.Remove(CacheName & "_" & MyCaheName)
        Application.unLock
    End Sub

    '释放所有缓存
    Public Sub RemoveAllCache()
        Dim Cachelist,i
        Cachelist=Split(GetallCacheName(),",")
        If UBound(Cachelist)>0 Then
            For i=0 to UBound(Cachelist)
                DelCahe Cachelist(i)

内容版权声明:除非注明,否则皆为本站原创文章。

转载注明出处:http://www.heiqu.com/3696.html