asp뻠닸잚

2018-09-06 11:33

阅读:555

  逞黨뻠닸돨鱗痰,乖拳乖冷꼇痰疼뜩綱죄,劍돨鱗痰綠쒔붤츠鞫,景깎角뚤黨斤口좆렷끽댕샀角홍鑒앴욋女충돨貢籃,儉콘붤봤뒈적痰寮샙돨코닸栗都,속醵ASP돨獵契槻쪽,숑햐륩蛟포돨맏덫,랍땡貢瞳侶寧렘충隣돤角離敲놔돨,獗儉君瞳돨dvbbs7.1.0경,뫘角瞳뻠닸돨적痰?玖惶菊뺘枾ⅲ?갰察㉣搾碩캉墓帑성敲병烟橘粒Ф佈盧眉貢쟁痰돨冷앎角촬냘읫綾돨뻠닸잚,苟충죗놔땡貢돨힛댕멕癎畇돨ASP뻠닸잚

컁쿰畇돨
릿齡덜쯤 덜쯤흔苟:
'**********************************************
'vbsCache잚

'橄昑valid,角뤠옵痰,혤令품털뙤
'橄昑name,cache츰,劤쉔뚤蹶빈립令
'렘랬add(令,돕퍅珂쇌),?阮?ache코휭
'橄昑value,럿쀼cache코휭
'橄昑blempty,角뤠灌?阮최?
'렘랬makeEmpty,姦렴코닸,꿎桿痰
'렘랬equal(긴좆1),털뙤cache令角뤠뵨긴좆1宮谿
'렘랬expires(time),錦맣법퍅珂쇌槨time
'컁쿰2002.12.24

'**********************************************
classCache
privateobj'cache코휭
privateexpireTime'법퍅珂쇌
privateexpireTimeName'법퍅珂쇌application츰
privatecacheName'cache코휭application츰
privatepath'uri

privatesubclass_initialize()
path=request.servervariables(url)
path=left(path,instrRev(path,/))
endsub

privatesubclass_terminate()
endsub

publicpropertygetblEmpty
'角뤠槨왕
ifisempty(obj)then
blEmpty=true
else
blEmpty=false
endif
endproperty

publicpropertygetvalid
'角뤠옵痰(법퍅)
ifisempty(obj)ornotisDate(expireTime)then
valid=false
elseifCDate(expireTime)<nowthen
valid=false
else
valid=true
endif
endproperty

publicpropertyletname(str)
'?阮?ache츰
cacheName=str&path
obj=application(cacheName)
expireTimeName=str&expires&path
expireTime=application(expireTimeName)
endproperty

publicpropertyletexpires(tm)
'路?阮첫揮閔굴?
expireTime=tm
application.lock
application(expireTimeName)=expireTime
application.unlock
endproperty

publicsubadd(var,expire)
'립令
ifisempty(var)ornotisDate(expire)then
exitsub
endif
obj=var
expireTime=expire
application.lock
application(cacheName)=obj
application(expireTimeName)=expireTime
application.unlock
endsub

publicpropertygetvalue
'혤令
ifisempty(obj)ornotisDate(expireTime)then
value=null
elseifCDate(expireTime)<nowthen
value=null
else
value=obj
endif
endproperty

publicsubmakeEmpty()
'姦렴application
application.lock
application(cacheName)=empty
application(expireTimeName)=empty
application.unlock
obj=empty
expireTime=empty
endsub

publicfunctionequal(var2)
'궐싹
iftypename(obj)<>typename(var2)then
equal=false
elseiftypename(obj)=Objectthen
ifobjisvar2then
equal=true
else
equal=false
endif
elseiftypename(obj)=Variant()then
ifjoin(obj,^)=join(var2,^)then
equal=true
else
equal=false
endif
else
ifobj=var2then
equal=true
else
equal=false
endif
endif
endfunction
endclass
컁쿰잚절綾vbsCache잚

'橄昑valid,角뤠옵痰,혤令품털뙤
'橄昑name,cache츰,劤쉔뚤蹶빈립令
'렘랬add(令,돕퍅珂쇌),?阮?ache코휭
'橄昑value,럿쀼cache코휭
'橄昑blempty,角뤠灌?阮최?
'렘랬makeEmpty,姦렴코닸,
'렘랬DelCahe,?쓱彙渼?
'렘랬equal(긴좆1),털뙤cache令角뤠뵨긴좆1宮谿
'렘랬expires(time),錦맣법퍅珂쇌槨time
'痰랬

setmyCache=NewCache
ifmyCache.validthen'털뙤角뤠옵痰(관윅법퍅,宅角뤠槨왕令)
response.writemyCache.value'渴놔
else
................
BoardJumpList=xxx
myCache.addBoardJumpList,dateadd(n,60,now)'畇흙뻠닸xxx.add코휭,법퍅珂쇌
response.writeBoardJumpList'渴놔
endif
myCache.makeEmpty()姦렴코닸
mycache.DelCahe()?쓱暈병?nbsp;

촬냘읫綾畇돨
릿齡덜쯤 덜쯤흔苟:
ClassCls_Cache
Rem==================賈痰綱츠====================
Rem=굶잚친욥角땡貢邱룡覩눼,鱗諒:촬냘읫綾。흔꽃痰굶잚친욥,헝꼇狼혼딜侶몸綱츠。侶뙈鬧姦꼇삔緞捲獵契돨醵똑。
Rem=鱗痰:뻠닸뵨뻠닸밗잿잚
Rem=무唐긴좆:Reloadtime법퍅珂쇌(데貫槨롸爐)홧伽令槨14400
Rem=MaxCount뻠닸뚤蹶돨離댕令,낚법橙菱땡?쓱輝밉척狂諱姆캘冬鏶H궝≒두?00
Rem=CacheName뻠닸莉돨悧츰냔,홧伽令槨Dvbbs,흔벎寧몸籃듐櫓唐낚법寧몸뻠닸莉,橙矜狼棍꼬맣긴侶몸令。
Rem=橄昑:Name땍屢뻠닸뚤蹶츰냔,怜畇橄昑。
Rem=橄昑:value뗍혤뵨畇흙뻠닸鑒앴。
Rem=변鑒:ObjIsEmpty()털뙤뎠품뻠닸角뤠법퍅。
Rem=렘랬:DelCahe(MyCaheName)癎묏?쓱譎뻗恥병易冬徵Р狂輝퓨병易冬捉컬惠퉤?
Rem========================
PublicReloadtime,MaxCount,CacheName
PrivateLocalCacheName,CacheData,DelCount
PrivateSubClass_Initialize()
Reloadtime=14400
CacheName=Dvbbs
EndSub
PrivateSubSetCache(SetName,NewValue)
Application.Lock
Application(SetName)=NewValue
Application.unLock
EndSub
PrivateSubmakeEmpty(SetName)
Application.Lock
Application(SetName)=Empty
Application.unLock
EndSub
PublicPropertyLetName(ByValvNewValue)
LocalCacheName=LCase(vNewValue)
EndProperty
PublicPropertyLetValue(ByValvNewValue)
IfLocalCacheName<>Then
CacheData=Application(CacheName&_&LocalCacheName)
IfIsArray(CacheData)Then
CacheData(0)=vNewValue
CacheData(1)=Now()
Else
ReDimCacheData(2)
CacheData(0)=vNewValue
CacheData(1)=Now()
EndIf
SetCacheCacheName&_&LocalCacheName,CacheData
Else
Err.RaisevbObjectError+1,DvbbsCacheServer,pleasechangetheCacheName.
EndIf
EndProperty
PublicPropertyGetValue()
IfLocalCacheName<>Then
CacheData=Application(CacheName&_&LocalCacheName)
IfIsArray(CacheData)Then
Value=CacheData(0)
Else
Err.RaisevbObjectError+1,DvbbsCacheServer,TheCacheDataIsEmpty.
EndIf
Else
Err.RaisevbObjectError+1,DvbbsCacheServer,pleasechangetheCacheName.
EndIf
EndProperty
PublicFunctionObjIsEmpty()
ObjIsEmpty=True
CacheData=Application(CacheName&_&LocalCacheName)
IfNotIsArray(CacheData)ThenExitFunction
IfNotIsDate(CacheData(1))ThenExitFunction
IfDateDiff(s,CDate(CacheData(1)),Now())<60*ReloadtimeThen
ObjIsEmpty=False
EndIf
EndFunction
PublicSubDelCahe(MyCaheName)
makeEmpty(CacheName&_&MyCaheName)
EndSub
EndClass
촬냘읫綾잚절綾
SetWydCache=NewCls_Cache
WydCache.Reloadtime=0.5'땍屢법퍅珂쇌(鹿롸爐槨데삔)
WydCache.CacheName=pages'땍屢뻠닸츰
IFWydCache.ObjIsEmpty()Then''털뙤角뤠옵痰(관윅법퍅,宅角뤠槨왕令)
Response.writeWydCache.Value
Else
..................
BoardJumpList=xxx
WydCache.Value=BoardJumpList'畇흙코휭
Response.writeBoardJumpList
Endif

mycache.DelCahe(뻠닸츰)?쓱暈병?nbsp;

slightboy畇돨'========================
릿齡덜쯤 덜쯤흔苟:
'clsCache.asp
'========================
'==begin:2004-6-2621:51:47
'==copyright:slightboy(C)1998-2004

'========================
'========================
'DimApplication(2)
'Application(0)Counter셕鑒포
'Application(1)dateTime렴零珂쇌
'Application(2)Content뻠닸코휭

PublicPREFIX
PublicPREFIX_LENGTH

PrivateSubClass_Initialize()
PREFIX=Cached:
PREFIX_LENGTH=7
EndSub
PrivateSubClass_Terminate
EndSub
'?阮챰幄?
PublicPropertyLetCache(ByRefKey,ByRefContent)
DimItem(2)
Item(0)=0
Item(1)=Now()
IF(IsObject(Content))Then
SetItem(2)=Content
Else
Item(2)=Content
EndIF
Application.Unlock
Application(PREFIX&Key)=Item
Application.Lock
EndProperty
'혤놔긴좆셕鑒포++
PublicPropertyGetCache(ByRefKey)
DimItem
Item=Application(PREFIX&Key)
IF(IsArray(Item))Then
IF(IsObject(Item))Then
SetCache=Item(2)
Else
Cache=Item(2)
EndIF
Application(PREFIX&Key)(0)=Application(PREFIX&Key)(0)+1
Else
Cache=Empty
EndIF
EndProperty
'쇱꿴뻠닸뚤蹶角뤠닸瞳
PublicPropertyGetExists(ByRefKey)
DimItem
Item=Application(PREFIX&Key)
IF(IsArray(Item))Then
Exists=True
Else
Exists=False
EndIF
EndProperty
'돤돕셕鑒포鑒令
PublicPropertyGetCounter(ByRefKey)
DimItem
Item=Application(PREFIX&Key)
IF(IsArray(Item))Then
Counter=Item(0)
EndIF
EndProperty

'?阮체팜揮澤굴?
PublicPropertyLetdateTime(ByRefKey,ByRefSetdateTime)
DimItem
Item=Application(PREFIX&Key)
IF(IsArray(Item))Then
Item(1)=SetdateTime
EndIF
EndProperty
'돤돕셕鑒포珂쇌
PublicPropertyGetdateTime(ByRefKey)
DimItem
Item=Application(PREFIX&Key)
IF(IsArray(Item))Then
dateTime=Item(1)
EndIF
EndProperty

'路零셕鑒포
PublicSubResetCounter()
DimKey
DimItem
Application.Unlock
IF(Left(Key,PREFIX_LENGTH)=PREFIX)Then
Item=Application(Key)
Item(0)=0
Application(Key)=Item
EndIF
Next
Application.Lock
EndSub
'?쓱彙넙犢병?
PublicSubClear(ByRefKey)
Application.Contents.Remove(PREFIX&Key)
EndSub
'헌왕청唐賈痰돨뻠닸
PublicSubClearUnused()
DimKey,Keys,KeyLength,KeyIndex
ForEachKeyinApplication.Contents
IF(Left(Key,PREFIX_LENGTH)=PREFIX)Then
IF(Application(Key)(0)=0)Then
Keys=Keys&VBNewLine&Key
EndIF
EndIF
Next
Keys=Split(Keys,VBNewLine)
KeyLength=UBound(Keys)
Application.Unlock
ForKeyIndex=1ToKeyLength
Application.Contents.Remove(Keys(KeyIndex))
Next
Application.Lock
EndSub
'헌왕杰唐뻠닸
PublicSubClearAll()
DimKey,Keys,KeyLength,KeyIndex
ForEachKeyinApplication.Contents
IF(Left(Key,PREFIX_LENGTH)=PREFIX)Then
Keys=Keys&VBNewLine&Key
EndIF
Next
Keys=Split(Keys,VBNewLine)
KeyLength=UBound(Keys)
Application.Unlock
ForKeyIndex=1ToKeyLength
Application.Contents.Remove(Keys(KeyIndex))
Next
Application.Lock
EndSub

EndClass
slightboyn잚절綾SetWyd=NewJayCache
Wyd.dateTime(Page)=珂쇌
IfWyd.Exists(Page)Then
Response.writeWyd.Cache(Page)'渴놔
Else
Wyd.Cache(Page)=xxx畇흙
Responxe.writexxx
EndIF
Wyd.Clear(page)'?쓱暈병?nbsp;


评论


亲,登录后才可以留言!