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).

186 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. Jasa kitchen set surabaya

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

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

    ReplyDelete
  41. 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
  42. Really helpfull and greats Information, Please check this out! server pulsa

    ReplyDelete
  43. 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
  44. only a few good blogs but this blog is very complete and quality Serbu4d

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

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

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

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

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

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

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

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

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

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

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

    ReplyDelete
  56. thankyou the information is very helpful. shibaqq

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

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

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

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

    ReplyDelete
  61. (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
  62. thank you very much because this blog is very useful and the content is very cool slot88

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

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

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

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

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

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

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

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

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

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

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

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

    ReplyDelete
  75. 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
  76. there are many blogs already exist but among all these blogs is the best sgp hari ini

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

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

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

    ReplyDelete
  80. explore this very interesting and useful site well! tempat penitipan kucing

    ReplyDelete
  81. you and i best moment is yet to come, find here
    pragmatic play

    ReplyDelete
  82. You have one thousand skill in the world
    gantengqq

    ReplyDelete
  83. must check this site, so cool and amazing, so many information in this site cara meningkatkan fungsi otak

    ReplyDelete
  84. Wow great post! Thankyou for sharing the information, its very helpful. pragmatic play indonesia

    ReplyDelete
  85. let's check this link, you can gain so many information on there. skema piramida

    ReplyDelete
  86. want any information? let's check this link. mlm syariah

    ReplyDelete
  87. let's check this amazing site, you will see so many interesting information in this site. masalah kulit badan

    ReplyDelete
  88. so cool and amazing, information in this site so helpful what is cryptocurency airdrop

    ReplyDelete
  89. this site so cool, so amazing, and so helpful, check it now! gaming coins

    ReplyDelete
  90. this site so cool, thank you for the amazing information ciri ciri skincare berbahaya

    ReplyDelete
  91. this site so amazing, must check this site, thank you!! kandungan skincare yang aman

    ReplyDelete
  92. this site so cool, all information in this site so amazing cara cek skincare bpom

    ReplyDelete
  93. This blog is very complete and very useful to read slot gacor online

    ReplyDelete
  94. awesome, so helpful information in this site, thank you for the information! bisnis kecantikan di indonesia

    ReplyDelete
  95. this site very useful, must check this amazing site! perbedaan suplemen dan vitamin

    ReplyDelete
  96. amazing site, every information in this site so useful! skema ponzi

    ReplyDelete
  97. check this site, so useful, amazing, and so many information in this site beda mlm dan money game

    ReplyDelete
  98. so amazing, must check this site, every information in this site so useful and cool. gangguan sistem pencernaan

    ReplyDelete
  99. so amazing, every information in this site so cool. jenis rambut

    ReplyDelete
  100. amazing site!! so useful informstion in this site bentuk suplemen

    ReplyDelete
  101. everyone must check this site, so useful and so cool perbedaan oem dan odm

    ReplyDelete
  102. check this site, so cool, amazing and so useful  zat paraben

    ReplyDelete
  103. Really this information very help me thanks guys! this are great Information, Please check this out! omnichannel marketplace Terbaik

    ReplyDelete
  104. How can this site can give us gain any information, Amazing companies that accept cryptocurrency

    ReplyDelete
  105. Let's check this site, you will be surprised about the information nft marketplace in india

    ReplyDelete
  106. Let's check this cool, amazing, and awesome site so many useful information in this site!!! perawatan gigi anak

    ReplyDelete
  107. Great post! more information about Software ERP Indonesia can be checked here
    Software ERP Indonesia

    ReplyDelete
  108. the article is very interesting and the website is also very good!! australian blog

    ReplyDelete
  109. nice blog. very informative and very useful. keep sharing what matters
    tiktok downloader HD

    ReplyDelete
  110. This website is filled with a lots of great article, just like this one.
    It was well-written and informative. Thank you!

    indonesia specialty coffee

    ReplyDelete
  111. Great article with excellent idea!Thank you for such a valuable article. I really appreciate for this great information.. rv refrigeration

    ReplyDelete
  112. I really like your blog. Great article. It's most evident, people should learn before they are able to grow your business

    ReplyDelete
  113. I really like your blog. Great article. It's most evident, people should learn before they are able to Buy Ozempic in Bulk China

    ReplyDelete
  114. A very awesome blog post. We are really grateful for your blog post. You will find a lot of approaches after visiting your post. I was exactly searching for. Thanks for such post and please keep it up michael kors bags brown

    ReplyDelete
  115. This was a shocking post. It has some look at here fundamental data on this subject. health and safety awareness course

    ReplyDelete
  116. so many cool information in this site! thank you  ludotogel

    ReplyDelete
  117. Impressive user interface! Navigating through the site is a breeze, and the design is visually appealing. Great job, team sub to unlock

    ReplyDelete
  118. Your website is a pleasure to explore – it's polished, engaging, and professionally crafted. sub to unlock

    ReplyDelete
  119. gmtoto88 menghadirkan sistem transaksi yang mudah dan cepat, memudahkan para pemain dalam mengelola akun mereka.

    ReplyDelete
  120. Immerse yourself in Balinese Traditional Reed Instrument Crafting with our Instrument Crafting Bali Tour
    Package, creating traditional musical instruments using woven reeds.

    ReplyDelete
  121. I found the article to be very informative and well-researched.
    tiktok downloadeder

    ReplyDelete
  122. Naga777 menyelenggarakan turnamen slot "Celestial Celebration" dengan tema alam semesta dan bonus tambahan.

    ReplyDelete
  123. Ikuti kursus pelatihan training iso 9001 2015 untuk memahami persyaratan standar mutu yang paling baru. Tingkatkan efisiensi operasional dan raih keunggulan kompetitif.

    ReplyDelete
  124. Ratu388 membanggakan diri sebagai penyedia permainan judi online terbaik dengan bonus besar dan layanan cepat.

    ReplyDelete
  125. Sambut keberuntungan dengan bergabung di X500 Slot - tempat yang memberikan Anda akses ke permainan slot paling mengasyikkan.

    ReplyDelete
  126. Kualitas Profesional, Layanan Terbaik: maklon skincare bogor sebagai Pilihan Utama.

    ReplyDelete
  127. Sbobet88: Tempatnya Taruhan Online yang Aman, Adil, dan Menghibur.

    ReplyDelete
  128. Rpjitu togel online is the ultimate destination for gaming enthusiasts. Join our platform now and unlock a world of excitement, challenges, and rewards!

    ReplyDelete
  129. Unlock a world of gaming excellence with Situs Olxtoto - where every bet is a step towards victory. situs olxtoto

    ReplyDelete
  130. Kimtoto Learn how to structure your website for maximum Kimtoto visibility and impact.

    ReplyDelete
  131. Your website design is so sleek and user-friendly, navigating through it is a breeze! Kimtoto

    ReplyDelete
  132. Your website's message of positivity and optimism has been a guiding light during challenging times, reminding me to stay focused on the brighter side of life. Markaszeus

    ReplyDelete
  133. Your website has encouraged me to step out of my comfort zone and pursue my passions with courage and conviction. Markaszeus

    ReplyDelete
  134. It's wonderful to hear that you discovered valuable information in the article. I'm grateful for your positive feedback and for taking the time to read the article. Solar Module Distributor in india

    ReplyDelete
  135. Found my dream job thanks to the expertise of these search firms!
    top executive search firms

    ReplyDelete
  136. distributor alat pemadam kebakaran Jamin keselamatan rumah Anda dengan pemadam kebakaran yang handal dari distributor alat pemadam kebakaran terpercaya.

    ReplyDelete
  137. Topup game murah di website kami dan rasakan pengalaman bermain yang lebih seru website topup game murah

    ReplyDelete
  138. Highly recommend this recruitment agency in Singapore for top talent!
    recruitment agency singapore

    ReplyDelete
  139. Nikmati tampilan user-friendly di situs ludotogel

    ReplyDelete
  140. Hokiwin menawarkan berbagai pilihan slot dengan tema menarik

    ReplyDelete
  141. Mpo303, situs terpercaya dengan reputasi terbaik di dunia slot online.

    ReplyDelete
  142. Dapatkan cashback dari setiap taruhan Anda di Mpo338.

    ReplyDelete
  143. Dive into an array of games offering the most enticing promotions and bonuses, with the smoothest mobile login through the official link! Dutaslot

    ReplyDelete
  144. Explore the most breathtaking game site with high-tech visuals and convenient login, with the option to download an unblockable mobile APK! Dewa99

    ReplyDelete
  145. Ayo bergabung dengan kursus desain grafis di bogor dan kembangkan kreativitasmu bersama kami!

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

    ReplyDelete
  147. Join sultan lotre for expert lottery advice, tips, and winning strategies. Increase your chances of winning! sultan lotre

    ReplyDelete
  148. Dapatkan promosi dan hadiah menarik setiap hari hanya di idslot88 yang selalu diperbarui. idslot88

    ReplyDelete
  149. This site offers a great mix of informative and entertaining content mega888 apk.

    ReplyDelete
  150. Brilliantly written! The author's passion for the topic shines through in every paragraph.
    tiktok 1080p downloader

    ReplyDelete
  151. This is a digital wonderland—so much thought and care went into this! mega888 apk

    ReplyDelete
  152. Professional website! All the information very good
    138 Slot

    ReplyDelete
  153. Fantastic job! The user interface is smooth and intuitive. happytoto4d

    ReplyDelete
  154. The user experience here is seamless; navigating through the pages is a breeze. sultan lotre

    ReplyDelete