Class

xiaoxiao2021-03-06  41

Ribbon stored original code <% Class Cls_Cache Public Reloadtime, MaxCount, CacheName Private LocalCacheName, CacheData, DelCount Private Sub Class_Initialize () Reloadtime = 14400 CacheName = "Cache" End Sub Private Sub SetCache (SetName, NewValue) Application.Lock Application (SetName) = NewValue Application.unLock End Sub Public Sub MakeEmpty (MyCaheName) Application.Lock Application (CacheName & "_" & MyCaheName) = Empty Application.unLock End Sub Public Property Let Name (ByVal vNewValue) LocalCacheName = LCase (vNewValue) End Property Public Property Let Value (ByVal vNewValue) If LocalCacheName <> "" Then CacheData = Application (CacheName & "_" & LocalCacheName) If IsArray (CacheData) Then CacheData (0) = vNewValue CacheData (1) = Now () Else ReDim CacheData (2) CacheData ( 0) = vNewValue CacheData (1) = Now () End If setCache CacheName & "_" & LocalCacheName, CacheData Else Err.Raise vbObjectError 1, "LvbbsCacheServer", "please change the CacheName." End If End Property Public Property Get Value ( ) LocalCacheName <> "" Then CacheData = Application (CacheName & "_" & LocalCacheName) If IsArray (CacheData) Then Value = CacheData (0) Else Err.Raise vbObjectError 1, "LvbbsCacheServer", "The CacheData Is Empty." End If Else Err.raise vbobjectError 1, "Lvbbscaccher", "please change the cachename" end if end protection public function objiisempty () objisempty = true cachedata = Application = APPLICATION (Cachename & "_" &

Localcachename) IFARRAY (CACHEDATA) THEN EXIT Function if not isdate (Cachedata (1)) THEN EXIT Function if Datediff ("s", cdate (cachedata (1)), now ()) <60 * reloadtime damjisempty = false End If End Function Public sub DelCache (MyCaheName) Application.Lock Application.Contents.Remove (CacheName & "_" & MyCaheName) Application.unLock End SubEnd Class%> example of use: <% 'aplication name: the name of the primary cache buffer sub _ name ,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,,, ABC "Cache Main Name .mycache.name =" VCD "'Cache De Name IF MyCache.objiSempty () THEN' But the cache is an empty setting cache. Content =" test
"Mycache.Value = Contentend iFRESPONSE. Write myCache.valueSet myCache = NothingSub DelCahe (MyCaheName) 'delete ribbon save Application.Lock Application.Contents.Remove (MyCaheName) Application.unLockEnd SubdelCahe ( "abc_vcdd") Function GetallCache ()' display ribbon store name Dim Cacheobj For Each Cacheobj in Application.contents response.write cacheobj & "
" NEXTEND FUNCTION%>

转载请注明原文地址:https://www.9cbs.com/read-56443.html

New Post(0)