ASP比较常用的缓存函数技巧

2022-06-28    分类: 网站建设

空间安装多个系统时使用,ASP比较常用的缓存函数技巧
Const WebCacheFlag = "Cache"

' 获取缓存 缓存名
Function GetCache(ByVal CacheName)
    Dim CacheData
    CacheName = LCase(ChangeChr(CacheName))
    CacheData = Application(WebCacheFlag & CacheName)
    If IsArray(CacheData) Then GetCache = CacheData(0) Else GetCache = ""
End Function

' 检测缓存 缓存名
Function ChkCache(ByVal CacheName)
    Dim CacheData
    ChkCache = False
    CacheName = LCase(ChangeChr(CacheName))
    CacheData = Application(WebCacheFlag & CacheName)
    If Not IsArray(CacheData) Then Exit Function
    If Not IsDate(CacheData(1)) Then Exit Function
    If DateDiff("s", CDate(CacheData(1)), Now()) < 60 * WebCacheTime Then ChkCache = True
End Function

' 设置缓存 缓存名,缓存值
Function SetCache(ByVal CacheName, ByVal CacheValue)
    Dim CacheData
    CacheName = LCase(ChangeChr(CacheName))
    CacheData = application(WebCacheFlag & CacheName)
    If IsArray(CacheData) Then
        CacheData(0) = CacheValue
        CacheData(1) = Now()
    Else
        ReDim CacheData(2)
        CacheData(0) = CacheValue
        CacheData(1) = Now()
    End If
    Application.Lock
    Application(WebCacheFlag & CacheName) = CacheData
    Application.UnLock
End Function

网页名称:ASP比较常用的缓存函数技巧
新闻来源:https://www.cdcxhl.com/news/172512.html

成都网站建设公司_创新互联,为您提供小程序开发网站改版App开发全网营销推广Google做网站

广告

声明:本网站发布的内容(图片、视频和文字)以用户投稿、用户转载内容为主,如果涉及侵权请尽快告知,我们将会在第一时间删除。文章观点不代表本网站立场,如需处理请联系客服。电话:028-86922220;邮箱:631063699@qq.com。内容未经允许不得转载,或转载时需注明来源: 创新互联

搜索引擎优化