You are here:Home»KB»Web Server»Caching»My Caching Notes
Tuesday, 08 December 2015 18:54

My Caching Notes

Written by

There are 2 types of file caching implicit and explicit when talking about browsers but a 3rd type of caching, is proxying which is dealt with by external servers to reduce network load.

Implicit

This is where a file might be read from the cache or not. this works by th use of the last-modified header. most browsers will ask the server if the file they seek is newer thant the version it has it its cache. if it does not have the file in the cache it will download the file and if it does have the file in its cache it will see, via a header request, if the file on the server is newer, if newer it will download, if not it will use the locally stored version. by default the las-modified header is always sent but can be disabled by removing the header which will force the files always to be downloaded if not other cache headers are set.

Explicit

This is set by using the 'expires' header. you can set a date on the server when you want this file to expire. what this does is tell the browser to use the locally stored file until the expiry date is passed, the browser will not even do a header look up, it just accepts that it should use the locally stored file witout question. using this metjhod reduces header lookups for files that it already has but has a downfall that if these files are updated on the webserver that they will not get updated until either the client empties their browser cache, presses CTRL+F5 for a hard refresh of the expiry date passes. it is also common when using this type of cachiing that you can unset the 'last-modified' header to reduce traffic from your webserver.

Proxies

This is a metjod of caching data between the webserver and the targeet client without anyone in the stream really noticing. these servers can be used to load balance traffic and off load the caching and serving of files to a specific machine where that is all it does. the proxy does not generate the code but just mearly keeps a copy of it and servers it to a client. A CDN is a type of proxy and probably one of the most recognisably uses of a proxy. A CDN is used to negate issues of a worldwide distrubutions of a single website. If a single website is loacted in america and someone in austrailia tries accessing this site they will find it a lot slower that someone in california trying to access this website becauser they are thousands of miles away so the traffic has to travel a lot further so if you have a copy of this american website on a proxy server in austrailia the site appears to run just as quick in austrailia as it is in america because the files are travelling from the proxy server located in austrailia and not amrica. Not only does this method save time but money aswell because transataltic traffic is expensive. Proxy servers are more complex than just blind file caching because of how websites work so they can sync data, load balance and much more which is all configurable but in the end they do what they say on the tin.

Read 818 times