ASP实现缓存类无错版

2019-01-13 18:14:06王冬梅

            equal=true 
        else 
            equal=false 
        end if 
    end if 
end function 

end class 

dim content,myCache
Set myCache = new Cache
myCache.name="sofoisndoffo" '定义缓存名称 
if myCache.valid then '如果缓存有效
 content=myCache.value '读取缓存内容
else
 content="sosuo8.com测试" '大量内容,可以是非常耗时大量数据库查询记录集
 myCache.add content,dateadd("n",1000,now) '将内容赋值给缓存,并设置缓存有效期是当前时间+1000分钟
end if
Response.Write(content)
'myCache.makeEmpty()  
set clsCache=nothing '释放对象
%>