If you want to sound like a web pro, there are definitely a few buzz words you can throw around to sound like a smarty pants. However, fancy words don’t mean much if you don’t know what they mean. With that in mind, let’s shine a little light on two of the most common web terms: cache and cookie.

Cache

Caching is the process of saving data onto a user’s local machine. So your browser’s cache is just the culmination of all that saved data. What this means is your browser will save some resources of a web page (typically CSS and Javascript) to your local machine instead of having to go out to the internet to fetch them every time you request to view that page. Here’s a diagram to help.

Cache

 

Using a cache, your browser can make significantly less requests to the server and thus load the page at a much faster rate. This also benefits the server itself as it has to handle less requests and can use its resources for other tasks. So you can think of caching as a win-win for the two main players of the web: servers and end-users.

Caching does have a couple downfalls, however. The biggest one is using old and irrelevant files. As a web developer, this can be particularly frustrating when trying to get client feedback about a website that is under development. The developer is constantly updating the Javascript and CSS associated with a site, but the client’s machine keeps using a cached copy of those files and thus they don’t see the updates.

Fortunately, most browsers offer easy ways to purge your cache or do a “hard refresh.” Here’s a couple tricks you can try to clear your cache.

  • hold ctrl and then refresh
  • hold shift and refresh
  • hold down the refresh button on the browser to see your options
  • If all else fails, simply jump into your browser’s settings and clear the cache manually

Use these techniques if a site looks a little wonky or if someone requests you clear your cache.

 

Cookies

 

30675773

 

Despite our dear old grandma’s misconception, browser cookies are not edible. Rather, a cookie is a way for a website to save some particular information about your visit to the site. For example, let’s say you want to buy that hot new Spice Girls album at Amazon. You jump onto the site, add the album to your cart, but then realize you left your wallet at work. Severely disappointed, you shut down your computer and shuffle off to bed.

Fast forward 24 hours and you’re ready to order the album again, wallet in hand. You open the site and bam, the album is still in your cart! Out of the thousands (millions?) of people visiting Amazon every second, how can the site distinguish your particular connection and fill your cart appropriately? The answer is with a cookie. Cookies are saved in a key / value format on a site by site basis. Key / value simple means:

Key / Value

The name of the information I’m looking for / what the value of that info is

Cart-Id / 20002

Cart Items / Spice Girls Album, CD Case

Here’s what some actual cookies look like from my particular amazon session

2013-02-28_1721

 

Now most of that looks like gibberish to you and me, which is perfectly fine. A lot of those cookies are used by the browser or Amazon for internal processes and don’t necessarily have an effect on your visit.

Cookies are ideal for allowing a site to identify your particular browser and thus customize your experience on the site. Some common things stored with cookies are:

  • profile information
  • shopping cart items
  • site settings
  • recently viewed products

 

I hope you’ve enjoyed the baking lesson for the day. Now share your new found knowledge with friends and families to show your prowess and fondness of Spice Girls.