Cache vs Cookies
Cookies and cache (or browser cache) are two forms of temporary storage kept on client’s machine to improve the performance of web pages. Cookie is a very small piece of information that is stored on the client’s machine by the web site and is sent back to the server each time a page is requested. Cache is a temporary storage of web page resources stored on client’s machine for quicker loading of the web pages.
What are Cookies?
What is Cache?
When a user types in the address of a web page or clicks on a hyperlink of a web page on her browser, a request for the corresponding page is sent to the appropriate web server. Then, web server sends the content of the page and the resources required view the page to the browser. The web browser on the client’s machine will display the page. However, if the resources (pictures or images, audio files and video files, etc.) are large files, they will take a considerable amount of time to reach the client’s machine (depending on the speed of the connection). This will lead to the slow loading of pages making it inconvenient or irritating for the user. In order to minimize this delay, and load the web pages quicker, these resources can be stored on the client’s machine (after loading the page for the first time), so that consecutive loads of the same page will acquire the embedded resource files from the local computer. This is called browser caching. In other words, cache is a temporary storage of web page resources stored on client’s machine for quicker loading of the web pages.
What is the difference between Cache and Cookies?
– Although cookies and cache are two ways to store data on client’s machine, they serve different purposes. Purpose of cookie is to store information to track different characteristics related to user, while the purpose of cache is to make the loading of web pages faster.
– Cookies keep information such as user preferences, while cache will keep resource files such as audio, video or flash files.
– Typically, cookies expire after some time, but cache is kept in the client’s machine until they are removed manually by the user.