|
马上注册,结交更多好友,享用更多功能,让你轻松玩转社区。
您需要 登录 才可以下载或查看,没有帐号?立即注册
x
实现规模效益。与传统的用户拥有硬件软件所有权和使用权以及传统的应用服务商提供一对一的服务模式不同,ASP拥有应用系统所有权,用户拥有使用权,应用系统集中放在ASP的数据中心中,集中管理,分散使用,以一对多的租赁的形式为众多用户提供有品质保证的应用技术服务,实现规模效益。缓存|页面|缓存Update1/8/2004
Atthetopofthepage:
<%
pStr="private,no-cache,must-revalidate"
Response.ExpiresAbsolute=#2000-01-01#
Response.AddHeader"pragma","no-cache"
Response.AddHeader"cache-control",pStr
%>
--------------------------------------------------------------------------------
Dontallowyourpagetobecached.Why?Youmightwanttopreventusersfromseeingoldcontent.Insertthefollowingcodeinthe<HEAD>tagofyourdocument.
<metahttp-equiv="Expires"content="Tue,04-Dec-199321:29:02GMT">
CacheNoMore(ASP)
byPhilPaxton
(Phil@matchw.com)
HerearethethingsdealingwiththeissueofcachinginASP:
1.Response.Expires=0
2.Response.ExpiresAbsolute=Now()-1
3.Response.AddHeader"cache-control","private"
4.Response.AddHeader"pragma","no-cache"
5.Addinga"cachebuster"bycreatingauniqueURL.
Notes:
#1issaidtoexpireat60seconds,not0.Also,KhinZaw(fromActiveServerPages@andASPAdvanced@)haspostedresearchfromtimespentwithsomeIISinternalsexpertsrevealingthiscanbeaverytouchyparametertorelyuponandusuallyrequiresarather"large"negativenumberorpedantically,thatwouldbeaverysmallnumber).
#2(myowncreation)says"expirethispage24hoursago",allowingfortimedifferences,ratherthanspecifyastaticdate.
#3,#4fromanMSKBarticle.Thecodeiscorrectbuttherearesomeincorrectstatementsinthearticleitself.
n.b.somerelatedKBarticlesinclude:
(INFO:ControllingtheCachingofWebPageswithIIS4.0)
(PRB:BrowserDoesntShowMostRecentVersionsofhtm/aspFiles)
(HowtoUsePragma:No-cachewithIISandIE)
#5myterm,butnotmytechnique.IE5.0candefeat#1-#4usedinconjunctionbutadding#5willbreakit.Iusuallyusesomethinglike"?NoCache=Rnd"afterastatement.BillWilkinson(ofChili!Soft)hasproposedanalternateof?NoCache=Server.URLEncode(Now())".
--------------------------------------------------------------------------------
Anotherthingtoremember:Netscapewillcontinuetocache,evenifyouturnallcachingoff.Thisbehaviorpersistedthrough4.5PR1,PR2,andnowinthereleasedversionof4.5.
Ifyoufearyoumighthavetodealwithcachinglater,youmightwanttobuildcontingenciesintoyourappasyougo.Retrofitting#5throughoutevenamedium-sizedappwouldtakearathersizeableeffort.Youcouldretrofit#1-#4(inclusive)ratherquicklywithasinglepassthroughtheapplication,but#5takesalotofextraeffort.Andtothatend,IdonteverResponse.RedirectanywhereinmycodeexceptsamplecodeIposttothelists(thenagain,theonlytimeIuseResponse.WriteistothelistbecauseIrelyonmyUtilities-Form.inclibraryforDisplay()andHTML()).EverythingisRedirect(NewURL)wheretheRedirectfunctionlookslikethis:
FunctionRedirect(NewURL)
IfNotIsEmpty(NewURL&"")Then
DimQuestionMark
QuestionMark=Instr(NewURL,"?")
IfQuestionMark=0Then
Response.RedirectNewURL&"?"&NoCacheURL()
Response.End
Else
Response.RedirectNEWURL&"&"&NoCacheURL()
Response.End
EndIf
EndIf
EndFunction
andNoCacheURLlookslikethis:
FunctionNoCacheURL()
OnErrorResumeNext
Randomize
RandomizenotneededifyouuseNow()
NoCacheURL="NoCache="&Server.URLEncode(rnd)
orNoCacheURL="NoCache="&Server.URLEncode(Now())
perBill
EndFunction</p>只要你想学,就没什么优缺点,上面那位大哥已经把网上的评论说了,但我认为想学哪个都一样,不然它就不可能在当今时代数字艺术方面存活到今天 |
|