当前位置: 首页 > 图文教程 > 网络编程 > ASP > ASP缓存类 【先锋缓存类】Ver2004

ASP
ASP字符串大写转换成小写 ASP小写转换成大写 ucase lcase
asp base64加解密函数代码
Discuz!NT 论坛整合ASP程序论坛
discuz 2.0整合asp系统,用户添加函数
P3P 和 跨域 (cross-domain) cookie 访问(读取和设置)
通过asp程序来创建access数据库
检查access数据库中是否存在某个名字的表的asp代码
asp #include file 与 #include virtual 的区别小结
一个带采集远程文章内容,保存图片,生成文件等完整的采集功能
asp 横排显示数据
asp base64 utf-8为了兼容asp.net的base64
两个非常规ASP木马(可躲过扫描)
asp DateDiff实现文字在特定时间后消失
ASP所有的Session变量获取实现代码
关于ASP eof与bof 区别分析
asp ajax注册验证之 防止用户名输入空格
asp sqlserver 执行存储过程返回记录集报对象关闭时不允许操作
ASP 获取文件扩展名函数getFileExt()
asp 简单分页代码
asp删除mssql数据库中没有记录的图片代码

ASP缓存类 【先锋缓存类】Ver2004


出处:互联网   整理: 软晨网(RuanChen.com)   发布: 2009-08-14   浏览: 296 ::
收藏到网摘: n/a

以下为引用的内容:
<%
&apos;-------------------------------------------------------------------------------------
&apos;转发时请保留此声明信息,这段声明不并会影响你的速度!
&apos;************************** 【先锋缓存类】Ver2004 ********************************
&apos;作者:孙立宇、apollosun、ezhonghua
&apos;官方网站:http://www.lkstar.com 技术支持论坛:http://bbs.lkstar.com
&apos;电子邮件:[email protected] 在线QQ:94294089
&apos;版权声明:版权没有,盗版不究,源码公开,各种用途均可免费使用,欢迎你到技术论坛来寻求支持。
&apos;目前的ASP网站有越来越庞大的趋势,资源和速度成了瓶颈
&apos;——利用服务器端缓存技术可以很好解决这方面的矛盾,大大加速ASP运行和改善效率。
&apos;本人潜心研究了各种算法,应该说,这个类是当前最快最纯净的缓存类。
&apos;详细使用说明或范例请见下载附件或到本人官方站点下载!
&apos;--------------------------------------------------------------------------------------
class clsCache
&apos;----------------------------
private cache &apos;缓存内容
private cacheName &apos;缓存Application名称
private expireTime &apos;缓存过期时间
private expireTimeName &apos;缓存过期时间Application名称
private path &apos;缓存页URL路径

private sub class_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
end sub

private sub class_terminate()
end sub

Public Property Get Version
Version="先锋缓存类 Version 2004"
End Property

public property get valid &apos;读取缓存是否有效/属性
if isempty(cache) or (not isdate(expireTime)) then
vaild=false
else
valid=true
end if
end property

public property get value &apos;读取当前缓存内容/属性
if isempty(cache) or (not isDate(expireTime)) then
value=null
elseif CDate(expireTime)<now then
value=null
else
value=cache
end if
end property

public property let name(str) &apos;设置缓存名称/属性
cacheName=str&path
cache=application(cacheName)
expireTimeName=str&"expire"&path
expireTime=application(expireTimeName)
end property

public property let expire(tm) &apos;设置缓存过期时间/属性
expireTime=tm
application.Lock()
application(expireTimeName)=expireTime
application.UnLock()
end property

public sub add(varCache,varExpireTime) &apos;对缓存赋值/方法
if isempty(varCache) or not isDate(varExpireTime) then
exit sub
end if
cache=varCache
expireTime=varExpireTime
application.lock
application(cacheName)=cache
application(expireTimeName)=expireTime
application.unlock
end sub

public sub clean() &apos;释放缓存/方法
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
cache=empty
expireTime=empty
end sub

public function verify(varcache2) &apos;比较缓存值是否相同/方法——返回是或否
if typename(cache)<>typename(varcache2) then
verify=false
elseif typename(cache)="Object" then
if cache is varcache2 then
verify=true
else
verify=false
end if
elseif typename(cache)="Variant()" then
if join(cache,"^")=join(varcache2,"^") then
verify=true
else
verify=false
end if
else
if cache=varcache2 then
verify=true
else
verify=false
end if
end if
end function
%>