先锋缓存类(极度加速ASP和提高执行效率)
来源:互联网 发布:幸福时光数码淘宝网址 编辑:程序博客网 时间:2024/05/16 09:06
clsCache 公共属性 引用内容:
valid 返回是否有效。true表示有效,false表示无效。只读。 Version 获取类的版本信息。只读。 value 返回缓存内容。只读。 name 设置缓存名称,写入。 expire 设置缓存过期时间,写入。
clsCache 公共方法 引用内容: add(Cache,ExpireTime) 对缓存赋值(缓存内容,过期时间) clean() 清空缓存 verify(cache2) 比较缓存值是否相同——返回是或否。
clsCache 使用示例 程序代码: <!--#include file="clsCache" --> <% dim content,myCache set myCache=new cache myCache.name="lkstar" '定义缓存名称 if myCache.valid then '如果缓存有效 content=myCache.value '读取缓存内容 else content="......" '大量内容,可以是非常耗时大量数据库查询记录集 myCache.add content,dateadd("n",1000,now) '将内容赋值给缓存,并设置缓存有效期是当前时间+1000分钟 end if set clsCache=nothing '释放对象 %>
<% '-------------------------------------------------------------------------------------'转发时请保留此声明信息,这段声明不并会影响你的速度!'************************** 【先锋缓存类】Ver2004 ********************************'作者:孙立宇、apollosun、ezhonghua'官方网站:http://www.lkstar.com 技术支持论坛:http://bbs.lkstar.com'电子邮件:kickball@netease.com 在线QQ:94294089'版权声明:版权没有,盗版不究,源码公开,各种用途均可免费使用,欢迎你到技术论坛来寻求支持。'目前的ASP网站有越来越庞大的趋势,资源和速度成了瓶颈'——利用服务器端缓存技术可以很好解决这方面的矛盾,大大加速ASP运行和改善效率。'本人潜心研究了各种算法,应该说,这个类是当前最快最纯净的缓存类。'详细使用说明或范例请见下载附件或到本人官方站点下载!'--------------------------------------------------------------------------------------class clsCache'----------------------------private cache '缓存内容private cacheName '缓存Application名称private expireTime '缓存过期时间private expireTimeName '缓存过期时间Application名称private path '缓存页URL路径private sub class_initialize()path=request.servervariables("url")path=left(path,instrRev(path,"/"))end sub private sub class_terminate()end subPublic Property Get Version Version="先锋缓存类 Version 2004"End Propertypublic property get valid '读取缓存是否有效/属性if isempty(cache) or (not isdate(expireTime)) thenvaild=falseelsevalid=trueend ifend propertypublic property get value '读取当前缓存内容/属性if isempty(cache) or (not isDate(expireTime)) thenvalue=nullelseif CDate(expireTime)<now thenvalue=nullelsevalue=cacheend ifend propertypublic property let name(str) '设置缓存名称/属性cacheName=str&pathcache=application(cacheName)expireTimeName=str&"expire"&pathexpireTime=application(expireTimeName)end propertypublic property let expire(tm) '设置缓存过期时间/属性expireTime=tmapplication.Lock()application(expireTimeName)=expireTimeapplication.UnLock()end propertypublic sub add(varCache,varExpireTime) '对缓存赋值/方法if isempty(varCache) or not isDate(varExpireTime) thenexit subend ifcache=varCacheexpireTime=varExpireTimeapplication.lockapplication(cacheName)=cacheapplication(expireTimeName)=expireTimeapplication.unlockend subpublic sub clean() '释放缓存/方法application.lockapplication(cacheName)=emptyapplication(expireTimeName)=emptyapplication.unlockcache=emptyexpireTime=emptyend sub public function verify(varcache2) '比较缓存值是否相同/方法——返回是或否if typename(cache)<>typename(varcache2) then verify=falseelseif typename(cache)="Object" then if cache is varcache2 then verify=true else verify=false end ifelseif typename(cache)="Variant()" then if join(cache,"^")=join(varcache2,"^") then verify=true else verify=false end ifelse if cache=varcache2 then verify=true else verify=false end ifend ifend function%>
- 先锋缓存类(极度加速ASP和提高执行效率)
- 先锋缓存类(极度加速ASP和提高执行效率)
- 先锋缓存类(极度加速ASP和提高执行效率)
- 先锋缓存类(极度加速ASP和提高执行效率)
- 提高ASP页面的执行效率(上)
- 提高ASP页面的执行效率(中)
- 提高ASP页面的执行效率(下)
- [ASP]提高数据显示效率--缓存探幽
- 提高ASP页面的执行效率
- 提高ASP页面的执行效率
- 对提高ASP执行效率的几点看法
- 对提高ASP执行效率的几点看法
- 先锋缓存类 Version 2004
- jquery编写提高执行效率(1)
- 提高php执行效率
- 提高matlab执行效率
- Windows7系统加速 提高办公效率【乡巴佬】
- 提高SQL语句执行效率的原则和方法
- 加载多级部门代码
- 轰动全球的十大营销理念
- 慧聪、铭万对冲阿里巴巴
- Bye-- Czech golden generation
- 加密技术在企业数据安全中的应用
- 先锋缓存类(极度加速ASP和提高执行效率)
- 加密算法中私钥的安全性
- 哪有那么多云计算
- 泛型编程与STL核心要素
- 建构大型商业系统所要考虑的事项
- centos5.1安装注意事项
- [转]ASP.net:cookies的丢失和中文乱码
- 让电子商务有人性
- Delphi程序在Xp Home下无法运行的问题