<%
'***************************************************
'vbsCache class
'Attribute valid, whether it is available, judge before taking the value
'Attribute name, cache name, assign value after creating a new object
'Method add(value, expiration time), set cache content
'Attribute value, return cache content
'Attribute blempty, whether the value is not set
'Method makesEmpty, free memory, test
'Method equal(variable 1), determines whether the cache value is the same as variable 1
'Method expires(time), modify the expiration time to time
'The cache class written by Muniao
'***************************************************
classCache
privateobj'cache content
privateexpireTime'Expiration Time
privateexpireTimeName'Expiration Time Application Name
privatecacheName'cache content application name
privatepath'uri
privatesubclass_initialize()
path=request.servervariables("url")
path=left(path,instrRev(path,"/"))
endsub
privatesubclass_terminate()
endsub
publicpropertygetblEmpty
'Is it empty
ifsempty(obj)then
blEmpty=true
else
blEmpty=false
endif
endproperty
publicpropertygetvalid
'Whether it is available (expired)
ifsempty(obj)ornotisDate(expireTime)then
valid=false
elseifCDate(expireTime)<nowthen
valid=false
else
valid=true
endif
endproperty
publicpropertyletname(str)
'Set cache name
cacheName=str&path
obj=application(cacheName)
expireTimeName=str&"expires"&path
expireTime=application(expireTimeName)
endproperty
publicpropertyletexpires(tm)
'Reset the expiration time
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock