ASP比较常用的缓存函数
2009-05-07 10:39:53 来源:WEB开发网'缓存时间,单位分钟
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
- ››asp.net页面弄成伪静态页面
- ››常用的Windows 7操作系统实用技巧
- ››Asp.net 中将汉字转换成拼音的方法
- ››ASP.NET及JS中的cookie基本用法
- ››ASP.NET获取MS SQL Server安装实例
- ››asp.net实现调用百度pai 在线翻译英文转中文
- ››ASP.NET页面选项进行提示判断
- ››Asp.net定时执行程序
- ››ASP.NET中利用DataList实现图片无缝滚动
- ››ASP.NET验证控件RequiredFieldValidator
- ››ASP.NET中使用System.Net.Mail发邮件
- ››ASP.NET中获取用户控件中控件的ID
更多精彩
赞助商链接