几个常用的ASP缓存函数介绍
发布时间:2023-07-29 14:53:34 所属栏目:Asp教程 来源:
导读:'缓存时间,单位分钟
Const WebCacheTime = 20
'缓存标示,用于一个空间安装多个系统时使用
Const WebCacheFlag = "Cache"
' 设置缓存 缓存名,缓存值
Function SetCache(ByVal Cac
Const WebCacheTime = 20
'缓存标示,用于一个空间安装多个系统时使用
Const WebCacheFlag = "Cache"
' 设置缓存 缓存名,缓存值
Function SetCache(ByVal Cac
'缓存时间,单位分钟 Const WebCacheTime = 20 '缓存标示,用于一个空间安装多个系统时使用 Const WebCacheFlag = "Cache" ' 设置缓存 缓存名,缓存值 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 ' 获取缓存 缓存名 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 (编辑:聊城站长网) 【声明】本站内容均来自网络,其相关言论仅代表作者个人观点,不代表本站立场。若无意侵犯到您的权利,请及时与联系站长删除相关内容! |
推荐文章
站长推荐