Nov 14, 2009

Client Side Caching: proxy servers and forced reload

In the previous blog post we have talked about caching basics. Let's review now how proxies actually work and how can we force cache reload.

Cache reload

The main issue with far future expires headers is that browser doesn't re-request resource but takes it from local cache. So if you have made any changes on your website they won't be visible for all 'old' users (with cached styles and scripts, HTML documents usually aren't cached so aggressively).

So what can we do with this trouble? How can we tell browsers to re-request such resources?

Main cache reload patterns

There are two main patterns to force browsers (user agents) to request the current asset once more.

  • Add to the file name any GET parameter (which should indicate new state of this asset). For example
    styles.css -> styles.css "physical" file name. For example
    styles.css -> styles.v20091114.css

Both approaches change URL of the asset and force browser to re-request it.

Cache reload and proxy servers

As you can see the first approach is simpler than the second. But there a few possible issues with it. First of all some proxy servers doesn't cache URL with GET parameter (i.e. our styles.css So if you have a lot of visitors from a network behind one firewall we will serve this asset to each visitor separately, without its caching of a proxy server. This will slow down overall website speed and sometimes this can be critical.

But how can we apply new file name without actual changes on file system? Is there any way to perform this with only change in HTML code? Yes!

Apache rewrite rules

Apache web server has a powerful tool to perform 'hidden' redirects for local file (this is called 'internal redirects'). We can manage the first way with just one predefined rule for all files (in our case it's a set of numbers after .v):

RewriteEngine On
RewriteRule ^(.*)\.v[0-9]+\.css$ $1.css

So all such files will be redirected to their physical equivalents but you can change a part of URL with .v at any time — and browsers will request this asset once more.

Automated cache reload

There are several ways to automate cache reload process for all changed files. As far as Web Optimizer combines all resources into 1 file, it's required to re-check file mtime (time of change) for all files and re-combine all resources.

Issues with re-checking all combined files have been already described last month, so it's not generally good to check them all with every web page visit. We can cache all previous checks into 1 file and check only its mtime. So it's done by default. By default we can check time of change of the only file (CSS or JS one) and add as a GET parameter or as a part of file name.

So this is applied for all such files (that should be cached on a client side) and results in the following:

/cache/website.css you can see there are two timestamps in these CSS files, one goes as a GET parameter, the other — as a part of URL (and with Apache mod_rewrite rule is transformed to /cache/website.css).

Overall schema

So what is overall caching algorithm for the website?

  1. Check if we have combined file. If no — create it.
  2. Check mtime of the combined file. If it's required add mtime to URL (using one of the described ways).
  3. Browser receives HTML code with the URL of combined file.
  4. Browser checks if it has this URL cached. If yes, all finished here.
  5. If not browser requests cached file (which is already prepared on the server or is cached on the proxy).

264 comments:

  1. This comment has been removed by a blog administrator.

    ReplyDelete
  2. There are different reasons for which we use the internet. Some use it to check their mail box or send a message. Some use it to find friends and chat with their loved ones. read this article

    ReplyDelete
  3. I am upbeat to locate your recognized method for composing the post. Presently you make it simple for me to comprehend and execute the idea. Much obliged to you for the post.  vpnveteran

    ReplyDelete
  4. In any event it ended a really fantastic trip for us on an absolute high. A case of being in the right place at the right time!" visita il sito

    ReplyDelete
  5. I am continually amazed by the amount of information available on this subject. What you presented was well researched and well worded in order to get your stand on this across to all your readers. find out more

    ReplyDelete
  6. I'm constantly searching on the internet for posts that will help me. Too much is clearly to learn about this. I believe you created good quality items in Functions also. Keep working, congrats! besuche die Website

    ReplyDelete
  7. This is only the data I am discovering all over the place. A debt of gratitude is in order for your website, I simply subscribe your online journal. This is a decent blog.. VPN

    ReplyDelete
  8. This is a truly good site post. Not too many people would actually. the way you just did. I am really impressed that there is so much information about this subject that have been uncovered and you’ve done your best. with so much class. If wanted to know more about green smoke reviews. than by all means come in and check our stuff. allertaprivacy

    ReplyDelete
  9. Just pure classic stuff from you here. I have never seen such a brilliantly written article in a long time. I am thankful to you that you produced this! weneedprivacy

    ReplyDelete
  10. I think this is an informative post and it is very useful and knowledgeable. therefore, I would like to thank you for the efforts you have made in writing this article. https://www.lemigliorivpn.com

    ReplyDelete
  11. Intriguing post. I Have Been pondering about this issue, so much obliged for posting. Really cool post.It "s truly extremely pleasant and Useful post.Thanks lesmeilleursvpn.com

    ReplyDelete
  12. Datacenter virtualization is most certainly necessary for most businesses to keep up with the explosion of data resources needed to keep pace with competitors.
    minecraft server hosting

    ReplyDelete
  13. I love significantly your own post! I look at all post is great. I discovered your personal content using bing search. Discover my webpage is a great one as you.I work to create several content this post. Once more you can thank you and keep it create! Enjoy! Klik hier

    ReplyDelete
  14. I think this is definitely an amazing project here. So much good will be coming from this project. The ideas and the work behind this will pay off so much. Meer hierover leest je hier

    ReplyDelete
  15. As a matter of fact, bloggers and other expert reviewers compose quality reviews in various ways. They go for slight varieties to get explicit outcomes.website reviews

    ReplyDelete
  16. Many small business owners struggle with deciding on how to make the right choice for designing their website. They search the web for help with their website and find that the choice is harder than they thought.Webdesign

    ReplyDelete
  17. Your post has those certainties which are not open from anyplace else. It's my unassuming solicitation to u please continue composing such astounding articles cheap vps

    ReplyDelete
  18. By using this type of Proxy, you will bypass a direct connection with the intended website and view the site under the Web Based Proxies IP address. torrentz2

    ReplyDelete
  19. This is actually the kind of information I have been trying to find. Thank you for writing this information. get free instagram likes famoid

    ReplyDelete
  20. Intermediary sites are accessible for nothing and numerous individuals use intermediaries to bring in cash. Certain intermediary sites permit you to ride the web for nothing, while some need a login. https://themersclub.com

    ReplyDelete
  21. Offline advertising and promotion - Business cards, postcards, traditional direct mail, newspaper ads, flyers, giveaways and brochures that feature a domain name are all excellent ways to promote a website. Trust Pilot Website Scraper Software

    ReplyDelete
  22. For the accomplishment of a website, it is essential to get guests and get business. To advertise a website viably, marketing devices are essential. To get great marketing results, these instruments assume a significant job. how to get email lists for marketing

    ReplyDelete
  23. On the off chance that your social media strategy has not been refreshed in the course of recent years, the approach is probably going to be out of consistence with the direction gave by the National Labor Relations Board as of late. SMM Panel

    ReplyDelete
  24. So if your site takes too long to even consider stacking, your rankings may endure. view cached web pages

    ReplyDelete
  25. Keep the connections shaded blue however much as could reasonably be expected in light of the fact that regular clients are now utilized with the tone. SEO Antwerpen

    ReplyDelete
  26. That is the reason you need to make it as simple as feasible for website guests to join your rundown. In the event that you don't have an eNewsletter information exchange structure on your website, contact your web engineer to add one. website development in pakistan

    ReplyDelete
  27. Consider adding web-based media sharing highlights to your website, particularly your blog articles, so individuals can undoubtedly impart them to their devotees to only a single tick. This can make significantly more brand openness and website traffic. Best Elementor Themes

    ReplyDelete
  28. Static Features - Despite some degree of customization choices, this is a basic example with highlights incapable to be custom-made to suit singular preferences and necessities. For any individual or business who flourishes with it's anything but, a layout won't be reasonable by any means. website developer australia

    ReplyDelete

  29. I like what you guys tend to be up too. This kind of clever work and reporting!
    Keep up the very good works guys I’ve added you guys to our blogroll.

    Try to check my blog: 부산오피
    (jk)

    ReplyDelete
  30. This comment has been removed by the author.

    ReplyDelete
  31. Speed of surfing ought not be compromised when you use proxy for riding the web. This is a significant element you should search for in any proxy you pick. best vpn reddit

    ReplyDelete
  32. Maximum anonymity and much more features are available for paid members, but you can still surf the internet from the proxy without paying anything. resources

    ReplyDelete
  33. Be careful with organizations that can provide you a cost estimate nearly without hearing any subtleties of your undertaking. Try not to be hesitant to pose bunches of inquiries! Clientica WordPress Agency

    ReplyDelete
  34. possessions, acquiring clearness in life through having less and searching for additional approaches to minimalize everything. What does this have to do with websites?sell domains names

    ReplyDelete
  35. Moderation is colossal at this moment. Many individuals are scaling down their assets, acquiring clearness in life through having less and searching for additional approaches to minimalize everything. https://hostinglelo.in/

    ReplyDelete
  36. Assuming every one of the locales resemble the other the same there's not really any shot at the guest recalling a particular website. jasa backlink

    ReplyDelete
  37. They can stay away from the whole course of searching for a designer and working with the expert on the website configuration by doing it all alone.https://sites.google.com/view/seoservicesindelhiindia

    ReplyDelete
  38. Wow great post! Thankyou for sharing the information, its very helpful. Judi Slot Online

    ReplyDelete
  39. Wow great post! Thankyou for sharing the information, its very helpful. Jasa kitchen set surabaya

    ReplyDelete
  40. Really helpfull and greats Information, Please check this out! jual ban loader

    ReplyDelete
  41. Really helpfull and greats Information, Please check this out! jual ban traktor

    ReplyDelete
  42. Really helpfull and greats Information, Please check this out! jual ban forklift

    ReplyDelete
  43. Really helpfull and greats Information, Please check this out! situs judi slot online terpercaya

    ReplyDelete
  44. Really helpfull and greats Information, Please check this out! https://shareswisswatches.co.uk

    ReplyDelete
  45. This blog is very complete and very high quality and very easy to understand cara melihat status wa tanpa diketahui di hp oppo

    ReplyDelete
  46. Really helpfull and greats Information, Please check this out! apk vcs gratis

    ReplyDelete
  47. Great blog article.Really looking forward to read more! idn slot

    ReplyDelete
  48. good post. never knew this, thanks for letting me know! situs judi bola

    ReplyDelete
  49. Maintenance of website performance and uptime 24*7 is certainly impossible for an individual, this is where the monitoring tools come into play. Apple Toolbox

    ReplyDelete
  50. only a few good blogs but this blog is very complete and quality Bandar slot games

    ReplyDelete
  51. Really helpfull and greats Information, Please check this out! server pulsa

    ReplyDelete
  52. the information on this blog is very helpful, im happy to stop by this blog situs judi online

    ReplyDelete
  53. Your website offered us with valuable info to work on! mawarslot

    ReplyDelete
  54. This is very interesting, Don't forget to visit our website pitbulqq

    ReplyDelete
  55. Wow great post! Thankyou for sharing the information, its very helpful. rental mobil silangit

    ReplyDelete
  56. Wow great post! Thankyou for sharing the information, its very helpful. slot online terpercaya

    ReplyDelete
  57. Wow great post! Thankyou for sharing the information, its very helpful. star777

    ReplyDelete
  58. This site is very useful, please stop by to visit and have a look! situs judi bola

    ReplyDelete
  59. Your website offered us with valuable info to work on! slot ovo

    ReplyDelete
  60. Well done information.thanks for the excellent article slot gacor

    ReplyDelete
  61. With Great post come great responbility
    Situs judi online terbaik
    Your content bringing new knowledge in the internet
    pkv poker qq
    Supperrrr.... Nice Content
    DewaQQ

    ReplyDelete
  62. only a few good blogs but this blog is very complete and quality Serbu4d

    ReplyDelete
  63. I just read this blog, it's very interesting and the content is very good kode remot tv akari

    ReplyDelete
  64. Continuously search for organizations that offer every minute of every day backing and unconditional promises. best cheap hosting

    ReplyDelete
  65. This site is very useful, please stop by to visit and have a look! judi bola

    ReplyDelete
  66. the information on this blog is very helpful, im happy to stop by this blog BandarQ228

    ReplyDelete
  67. good post. never knew this, thanks for letting me know! BandarQ

    ReplyDelete
  68. I think this blog is the best and most trusted Slot 4D

    ReplyDelete
  69. this blog is interesting, im happy to stop by this blog! DewaQQ

    ReplyDelete
  70. I read that Post and got it fine and informative. Poker QQ

    ReplyDelete
  71. Well done information.thanks for the excellent article Bimtek Keuangan

    ReplyDelete
  72. Great blog article.Really looking forward to read more! Bimtek Kepegawaian

    ReplyDelete
  73. Wow great post! Thankyou for sharing the information, its very helpful. situs judi online

    ReplyDelete
  74. Wow great post! Thankyou for sharing the information, its very helpful. sewa mobil silangit

    ReplyDelete
  75. Your website offered us with valuable info to work on! Bimtek Aset Barang

    ReplyDelete
  76. Thanks for the information provided! Maintain the good performance of your site. You can also check my site yukami

    ReplyDelete
  77. Thanks for the information provided! Maintain the good performance of your site. You can also check my site kaolin clay supplier indonesia

    ReplyDelete
  78. Really helpfull and greats Information, Please check this out! master888 slot

    ReplyDelete
  79. Really helpfull thanks guys! this are great Information, Please check this out! login pkv games

    ReplyDelete
  80. Thankfully this information is very helpfull and great Information, Please check this out! Bandar judi slot online

    ReplyDelete
  81. Wow great post! Thankyou for sharing the information, its very helpful. Domino228

    ReplyDelete
  82. Wow great post! Thankyou for sharing the information, its very helpful. Qqslot77

    ReplyDelete
  83. Wow great post! Thankyou for sharing the information, its very helpful. Naga99

    ReplyDelete
  84. the information on this blog is very helpful, im happy to stop by this blog Sewa hiace semarang

    ReplyDelete
  85. there are still very few blogs that are as good as this and the very best asikdewa

    ReplyDelete
  86. very nice to see and very grateful that this blog has helped pitbulqq

    ReplyDelete
  87. thank you very much because this blog is very useful and the content is very cool cepekqq

    ReplyDelete
  88. Thank you for the support and give me everythink knowledge
    game wik wik

    ReplyDelete
  89. good post. never knew this, thanks for letting me know! Sewa hiace jakarta

    ReplyDelete
  90. I really like your writing so so much! percentage we keep in touch more about your post on AOL? I require a specialist in this house to solve my problem. May be that is you! Having a look ahead to peer you. 바카라사이트

    ReplyDelete
  91. Very good blog! Do you have any suggestions for aspiring writers? I’m planning to start my own site soon but I’m a little lost on everything. 토토사이트

    ReplyDelete
  92. Your website offered us with valuable info to work on! Slot99

    ReplyDelete
  93. This is very interesting, Don't forget to visit our website Bet303

    ReplyDelete
  94. Really helpfull thanks guys! this are great Information, Please check this out! result totomacau

    ReplyDelete
  95. Really helpfull thanks guys! this are great Information, Please check this out! data keluaran totomacau

    ReplyDelete
  96. thankyou the information is very helpful. Bigslot77

    ReplyDelete
  97. thankyou the information is very helpful. Nagaslot77

    ReplyDelete
  98. This blog is very interesting, and very helpful, hopefully it will grow. klinik dokter gigi

    ReplyDelete
  99. Well done information.thanks for the excellent article cloud hosting

    ReplyDelete
  100. thank you very much because this blog is very useful and the content is very cool apk

    ReplyDelete
  101. thank you very much for this blog because it is very helpful and useful doaslot

    ReplyDelete
  102. SPK Systems is a web design and development Company in India with expertise in Web design, Digital Marketing, Logo & Branding. Call Now for a Free Quote!


    web design in india
    web design and development in chennai

    ReplyDelete
  103. This site is very helpful, thanks for the information. penambalan gigi

    ReplyDelete
  104. thank you very much because this blog is very useful and the content is very cool slot rezeki

    ReplyDelete
  105. Check this site, there is a lot of interesting and useful information in it. veneer gigi

    ReplyDelete
  106. thankyou the information is very helpful. shibaqq

    ReplyDelete
  107. thankyou the information is very helpful. jasa iklan google ads

    ReplyDelete
  108. This site really helped me with the information in it, thank you perawatan gigi anak

    ReplyDelete
  109. This site is so good and very useful. check this site perawatan saluran akar gigi

    ReplyDelete
  110. thankyou the information is very helpful. pkv games

    ReplyDelete
  111. Really from my heart thanks guys! this are great Information, Please check this out! Star777

    ReplyDelete
  112. thank you very much because this blog is very useful and the content is very cool bet88 slot

    ReplyDelete
  113. Awesome, this link will shock you with their information, I love it. Let's check it out nft games

    ReplyDelete
  114. Awesome, there's a lot of information in this site, let's check if there is any information there duck games

    ReplyDelete
  115. (RTP Slot) merupakan tolak ukur tingkat kemungkinan menang game slot online. Informasi slot gacor hari ini ditampilkan dengan hitungan persen sebagai ukuran keberhasilan. http://www.kohjumonline.com

    ReplyDelete
  116. thank you very much because this blog is very useful and the content is very cool slot88

    ReplyDelete
  117. thankyou the information is very helpful. Pkv

    ReplyDelete
  118. thankyou the information is very helpful. Agen Bola

    ReplyDelete
  119. This comment has been removed by the author.

    ReplyDelete
  120. Let's! visit a very useful and interesting website bandarqq

    ReplyDelete
  121. thankyou the information is very helpful. wslot88

    ReplyDelete
  122. Great blog, interesting to explore here! Bandar Bola

    ReplyDelete
  123. thank you very much because this blog is very useful and the content is very cool Indo Dewa QQ

    ReplyDelete
  124. This is the first time I've found a blog as good and comprehensive as this one PKV Games

    ReplyDelete
  125. Great blog, interesting to explore here! BandarQ

    ReplyDelete
  126. This site is very useful, and so many information in here. Check this out. arti mimpi pacar selingkuh

    ReplyDelete
  127. This link is so awesome, I never see the awesome link like this perusahaan maklon

    ReplyDelete
  128. Thanks for the information provided! Maintain the good performance of your site. You can also check my site distributor alat pemadam kebakaran

    ReplyDelete
  129. Check this site, this site is very useful. slot online

    ReplyDelete
  130. thank you very much because this blog is very useful and the content is very cool poker online

    ReplyDelete
  131. Really from my heart thanks guys! this are great Information, Please check this out! https://www.grancruzada.org/

    ReplyDelete
  132. thankyou the information is very helpful. mi77

    ReplyDelete
  133. good post. never knew this, thanks for letting me know! Kampus teknologi dan bisnis energi

    ReplyDelete
  134. Your site in my social networks! satta result
    agen judi bola

    ReplyDelete
  135. thankyou the information is very helpful. wingbola

    ReplyDelete
  136. Let's check this link, so many information in there 3d metaverse games

    ReplyDelete
  137. thankyou the information is very helpful. slot terpercaya

    ReplyDelete
  138. This site is very cool, check it now Bos138

    ReplyDelete
  139. thank you very much because this blog is very useful and the content is very cool usaha yang jarang tapi dibutuhkan

    ReplyDelete
  140. A lot of interesting information can be obtained from this site!! Kampus Swasta Unggulan di Jakarta

    ReplyDelete
  141. still wonder my best part till i meet
    judi bola

    ReplyDelete
  142. thankyou the information is very helpful. sky77

    ReplyDelete
  143. thankyou the information is very helpful. jasa followers

    ReplyDelete
  144. Nice information, valuable and excellent design, as share good stuff with good ideas and concepts, lots of great information and inspiration, both of which I need, thanks to offering Jasa Pindahan Jakarta

    ReplyDelete
  145. there are many blogs already exist but among all these blogs is the best sgp hari ini

    ReplyDelete
  146. look at this site, so many useful information in this site! macam macam kosmetik bibir

    ReplyDelete
  147. this site very cool and very useful, check it now! jenis produk skin care

    ReplyDelete
  148. wow! so many useful information in this site, check it now. jenis produk perawatan tubuh

    ReplyDelete
  149. thanks for sharing this helpful information. let's explore this site so good! pacuan kuda togel

    ReplyDelete
  150. thank you very much because this blog is very useful and the content is very cool Empiretoto

    ReplyDelete
  151. Let's check this site, so many useful information in there ciri ciri wajah yang terkena merkuri

    ReplyDelete
  152. This is very interesting, Don't forget to visit our website Prediksi Togel

    ReplyDelete
  153. thanks for sharing,this web a lot of helpful information. let's explore this site so good! agen pulsa

    ReplyDelete
  154. check this site now, and you will see so many interesting information in this site jenis produk perawatan rambut

    ReplyDelete
  155. wow, this site so interesting, so many information in there jenis jenis kosmetik

    ReplyDelete
  156. This website is great, lots of useful information. Let's explore this site well! Rtp Slot Gacor

    ReplyDelete
  157. Let's check this site, so many useful information in this site cara detoksifikasi tubuh secara alami

    ReplyDelete
  158. wow excellent blog! the content is very interesting and useful. i really enjoyed reading it. thanks! gigi gingsul

    ReplyDelete
  159. nice information! thanks for sharing the useful article. it was interesting and fun. i really enjoyed reading it. gigi kelinci

    ReplyDelete
  160. thank you very much because this blog is very useful and the content is very cool Panduan Login PAS77

    ReplyDelete