简单的页面缓冲技术

前言:其实说它为技术,也许不能说是真正的技术。这只不过是我自已想出来的页面处理的方法,当然与别人的想法可能是一致的。不过我还是想给它一个好听的名字。那么我这里所指的页面缓冲是什么呢?就是指将动态生成的页面保存起来,供下一次的使用。这样下一次访问它可能就不需要动态生成了。就象提供了一个cache 一样,在我的网站上,也许你的网站也是如此,使用了象模板之类的技术,这样用户所看到的页面就是动态生成的。但是一个页面对于你是这样,对于别人可能还是这样,即在一段时间内是不会变化的,如果将上次生成的结果直接返回给下一次访问的用户不是更好吗?减少了生成时间,效率要高一些。我想随着网站的发展,速度与效率问题还是要考虑的。这里我给出我的实现,希望对大家有所帮助。只是一个思路,没有具体的实现。

使用条件:是不是所有的网页最好都使用呢?我想不需要,而且也不可能。之所以能缓冲就是因为下一次访问与上一次访问的内容可能是完全一样的。所以对于经常变化的页面就不合适了。比如页面上要显示计数信息的就不太合适。还有就是如果你的动态页面输出时,没有先输出到变量中,而是直接返回给用户,如使用echo,print ,readfile之类的输出,我个人认为现在还作不到。因为无法将输出结果得到,保存到文件中去(反正我是想了半天没有想出有什么可以将直将输出的东西截下来,重定向到文件中去),那么比较适的动态页面的处理就是:输出结果应该可以放到一个字符串之中。所以使用条件就是:页面基本不会变化

动态页面的处理结果可以存放到字符串中

这样使用模板类来处理动态页面就很好了。通过在模板中设置可替换的变量,然后根据实际的值替换相应的模板中的变量,同时可以将结果放到字符串中进行输出,这种模板类的处理非常适合保存处理后的页面。当然不使用模板类,也可以通过字符串的处理来生成输出结果也是可行的。至于怎么做就不讨论了。

实现:如前所述,不是一个真正的实现,而是一个实现的思路。

处理流程:根据访问的要求,生成缓冲文件名,查看文件名是否存在,如果文件不存在,则生成动态页面,将页面保存,同时输出结果,结束;如果存在,则执行第3步,统计文件的修改时间,及与动态页面生成有关的文件的修改时间,比较缓冲文件的修改时间与其它页面的修改时间,如果其它页面修改时间大于缓冲文件修改时间,认为动态结果可能会发生变化,则重新生成动态页面结果,保存到文件中,且输出结果,结束;否则执行第5步 

说明缓冲文件最新,则直接输出缓冲文件:这就是我的处理m至于缓冲文件如何保存,可以建一个临时目录也可以使用数据库处理。如果使用了数据库则判断文件是否最新的方式也应作变化,比如在数据库中增加生成时间字段,比较这个时间字段与其它文件的修改时间即可,方法大家自已想。

波比源码 – 精品源码模版分享 | www.bobi11.com
1. 本站所有资源来源于用户上传和网络,如有侵权请邮件联系站长!
2. 分享目的仅供大家学习和交流,您必须在下载后24小时内删除!
3. 不得使用于非法商业用途,不得违反国家法律。否则后果自负!
4. 本站提供的源码、模板、插件等等其他资源,都不包含技术服务请大家谅解!
5. 如有链接无法下载、失效或广告,请联系管理员处理!
6. 本站资源售价只是赞助,收取费用仅维持本站的日常运营所需!
7. 本站源码并不保证全部能正常使用,仅供有技术基础的人学习研究,请谨慎下载
8. 如遇到加密压缩包,请使用WINRAR解压,如遇到无法解压的请联系管理员!

波比源码 » 简单的页面缓冲技术

260 评论

  1. buy levaquin 500mg for sale levaquin uk

  2. purchase fildena pill tamoxifen uk generic methocarbamol 500mg

  3. order sildenafil without prescription estradiol 2mg tablet order generic estradiol 2mg

  4. cheap arimidex Pfizer viagra purchase viagra generic

  5. benicar 20mg oral diamox ca buy diamox 250 mg pills

  6. imdur 40mg pills azathioprine us telmisartan online order

  7. order omeprazole 10mg for sale gambling games play money poker online

  8. usa cialis sales cost cialis sildenafil 100mg us

  9. order tamsulosin 0.2mg aldactone cost buy aldactone pills

  10. buy tiotropium bromide 9 mcg sale spiriva 9mcg drug terazosin 1mg pill

  11. buy ivermectin stromectol stromectol us avlosulfon 100mg sale

  12. ramipril 5mg ca altace 10mg ca buy etoricoxib for sale

  13. Thank you for content. Area rugs and online home decor store. Hello Administ . Metropol Halı Karaca Halı Öztekin ve Selçuklu Halı Cami Halısı ve Cami Halıları Türkiye’nin En Büyük Cami Halısı Fabrikasıyız…

  14. pills for erection best ed pill order proscar

  15. order dutasteride avodart price order generic orlistat 120mg

  16. explanatory thesis thesis topics where does the thesis go in an essay

  17. what is a thesis sentence thesis advisor can a thesis statement be two sentences

  18. sildenafil for men over 50 viagra next day tadalafil 20mg over the counter

  19. order cetirizine 5mg without prescription zyrtec canada order sertraline 100mg without prescription

  20. buy neurontin 600mg lasix generic buy doxycycline without a prescription

  21. sumatriptan 25mg brand avodart ca dutasteride buy online

  22. I really love to read such an excellent article. Helpful article. Hello Administ . Hacklink Panel Hacklink

  23. effexor vs cymbalta weight gain duloxetine info cymbalta withdrawl how long

  24. can sertraline hydrochloride get you high dosage for zoloft sertraline pronunciation

  25. order generic carbamazepine buy ciplox for sale lincomycin 500mg without prescription

  26. buy careprost generic cost careprost buy cheap generic desyrel

  27. buy clonidine pills for sale buy spiriva pill spiriva 9 mcg tablet

  28. purchase naproxen online naproxen medication lansoprazole 15mg without prescription

  29. carvedilol 25mg price cenforce uk where to buy chloroquine without a prescription

  30. order rhinocort generic careprost order purchase careprost online cheap

  31. keflex 500 for bronchitis keflex vision keflex for prostatitis

  32. order generic meclizine 25 mg minocycline cheap buy cheap generic minocycline

  33. can i take cephalexin if i have a sulfa allergy fish cephalexin is cephalexin ok for dogs

  34. best ed pills at gnc cialis 20mg ca purchase tadalafil

  35. buy ed pills without a prescription cialis 40mg oral brand tadalafil 5mg

  36. augmentin klebsiella pneumoniae augmentin meals augmentin with tylenol

  37. furadantin 100 mg oral motrin sale order pamelor 25mg

  38. purchase glipizide pill buy nootropil betnovate online

  39. buy paracetamol cheap paxil ca buy generic famotidine online

  40. buy tacrolimus generic tacrolimus sale buy ropinirole generic

  41. trileptal over the counter trileptal online actigall 300mg brand

评论已关闭

Hi, 如果你对这款模板有疑问,可以跟我联系哦!

联系站长
赞助VIP 享更多特权,建议使用 QQ 登录
喜欢我嘛?喜欢就按“ctrl+D”收藏我吧!♡