<% 'Timeout '------------------------------------------------------------------------------------- 'Keep this declaration information during forwarding. This declaration does not affect your speed! ************************** [Pioneer cache class] ver2004 ******* ************************* 'Authors: Sun LiYu, Apollo sun, ezhonghua 'Official Site: http://www.lkstar.com technical support forum: http://bbs.lkstar.com 'Email: kickball@netease.com online QQ: 94294089 'Copyright Disclaimer: no copyright, no piracy, public source code, and free use of various purposes. You are welcome to the Technical Forum for support. 'The current ASP websites are getting bigger and bigger, and resources and speed have become bottlenecks '-- Using the server-side cache technology can solve this conflict well, greatly accelerating ASP operation and improving efficiency. 'I have studied various algorithms with great concentration. It should be said that this class is the fastest and purest cache class currently. 'For detailed instructions or examples, please download the attachment or go to your official site to download it! 'Timeout '-------------------------------------------------------------------------------------- Class clscache '---------------------------- Private cache 'cached content Private cachename 'cache Application name Private expiretime 'cache expiration time Private expiretimename 'cache expiration time application name Private path 'cache page URL pathPrivate sub class_initialize () Path = request. servervariables ("url ") Path = left (path, limit Rev (path ,"/")) End sub Private sub class_terminate () End sub Public property get version Version = "Pioneer cache class version 2004" End Property Public property get valid' whether the read cache is valid/attribute If isempty (cache) or (not isdate (expiretime) then Vaild = false Else Valid = true End if End Property Public property get value' reads the content/attribute of the current Cache 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) 'sets the cache name/attribute Cachename = STR & Path Cache = Application (cachename) Expiretimename = STR & "expire" & Path Expiretime = Application (expiretimename) End Property Public property let expire (TM) 'sets the cache expiration time/attribute Expiretime = TM Application. Lock () Application (expiretimename) = expiretime Application. Unlock () End Property Public sub add (varcache, varexpiretime) 'value to the cache/Method 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 () 'release Cache/Method Application. Lock Application (cachename) = empty Application (expiretimename) = empty Application. Unlock Cache = empty Expiretime = empty End sub Public Function verify (varcache2) 'compares whether the cache value is the same/method -- return YES or NO 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 %> |