CLSCache Public Properties
Quote content:
Valid returns whether it is valid. TRUE is effective, FALSE is invalid. Read only.
Version gets the version information of the class. Read only.
VALUE returns the cache content. Read only.
Name Set the cache name, write.
EXPIRE Sets the cache expiration time, write.
CLSCache public method
Quote content:
Add (Cache, ExpiRetime) assigns a cache (cache content, expiration time)
Clean () empty cache
Verify (cache2) compares whether the cache value is the same - returns or no.
CLSCache Example
code:
<%
DIM Content, Mycache
Set mycache = new cache
mycache.name = "lkstar" 'Defines the cache name
If mycache.valid life 'If the cache is valid
Content = mycache.value 'Read Cache Content
Else
Content = "..." '' large amount of content, can be a very time-consuming database query record set
Mycache.add Content, DateAdd ("N", 1000, NOW) 'assigns the content to the cache, and sets the cache validity period is the current time 1000 minutes.
END IF
Set clscache = Nothing 'release object
%>
code:
<%
'------------------------------------- ------------------------------------
Please keep this declaration information when forwarding, this declaration will not affect your speed!
'************************ [Pioneer cache class] VER2004 ***************** ****************
'Author: Sun Liyu, apollosun, ezhonghua
'Official website:
Http://www.lkstar.com Technical Support Forum:
http://bbs.lkstar.com
'Email: kickball@netese.com Online QQ: 94294089
'Copyright Notice: No copyright, piracy, source code is open, all uses can be used free, welcome you to the technical forum to seek support.
'The current ASP website has increasing trends, resources and speeds become bottlenecks.
'- Using server-side cache technology can solve this contradiction in this area, greatly accelerate ASP operation and improve efficiency.
"I am working hard to study various algorithms, it should be said that this class is the current fastest and purest cache class.
'Detailed instructions or samples, please see the download attachment or to the official site download!
'------------------------------------- -------------------------------------
Class Clscache
'----------------------------
Private cache 'cache content
Private cachename 'Cache Application Name
Private eviRetime 'Cache Expired
Private eviRetimename 'Cache Expired Time Application Name
Private path 'Cache page URL Path Private Sub Class_Initialize ()
Path = Request.serverVariables ("URL")
PATH = Left (path, INSTRREV (PATH, "/"))
End Sub
Private sub coplass_terminate ()
End Sub
Public property Get Version
Version = "Pioneer Cache Version 2004"
End Property
Public property get valid 'Read Cache Valid / Property
If ISEMPTY (Cache) or (not isdate (expiRetime)) THEN
VAILD = FALSE
Else
Valid = TRUE
END IF
End Property
Public property get value 'reads the current cache content / attribute
If ISEMPTY (Cache) or (not isdate (expiRetime)) THEN
Value = NULL
Elseif Cdate (ExpiRetime) Value = NULL Else Value = cache END IF End Property Public Property Let Name (STR) Set Cache Name / Property Cachename = STR & PATH Cache = Application (cachename) ExpiRetimename = Str & "Expire" & path ExpiRetime = Application (ExpiRetimename) End Property Public Property Let Expire (TM) Set Cache Expired Time / Properties ExpiRetime = TM Application.lock () Application (expiRetimename) = eviRetime Application.unlock () End Property Public Sub Add (VAREXPIRETIME) '' for cache assignment / method If ISEMPTY (VARCACHE) or not isdate (VAREXPIRETIME) THEN EXIT SUB END IF Cache = varcache ExpiRetime = VAREXPIRETIME Application.lock Application (cachename) = cache Application (expiRetimename) = eviRetime 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) 'The comparison value is the same / method - return or no If TypeName (cache) <> typeename (varcache2) THEN Verify = false Elseif TypeName (cache) = "Object" THEN if cache is varcache2 thenverify = 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 %>