Compare the Difference Between Similar Terms

Difference Between Cache and Cookies

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?

Netscape introduced the concept of cookies with their Netscape Navigator web browser. 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. Because cookies are sent back each time, a minimum amount of data must be saved in order to save bandwidth. A web site only reads the cookie written by it, thus providing a secure means of storing information across different pages. However, cookies did not receive a good name initially, because of rumors that claimed cookies could read all the information on the hard drive. Of course, this misconception faded away as people realized that cookies are actually harmless, and now they are highly accepted. Cookies have a certain life span defined by their creators. At the end of this, a cookie becomes expired. Cookies often track information like how frequently the user visits, what are the times of visits, what banners have been clicked on, user preferences, etc. Cookies are usually used to store information needed for shorter periods. If information like email addresses (which must be kept for longer periods) need to be stored, the programmer needs to use a database instead of cookies. However, if personal information does get stored in cookies, encryption needs to be used to improve security.

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.