• Skip to primary navigation
  • Skip to main content
  • Skip to footer

 01472 897335

  connect@lykeltd.com

  • Facebook
  • Twitter
Lyke Ltd

Lyke Ltd

Experts at Custom Software

  • Bespoke Solutions
  • Case Studies
  • Covid-19
  • About
Contact Us

Caching

Caching is a fantastic piece of technology that improves your browsing experience. Learn how it works, and why it's a bit of a pain!

February 17, 2020 by lykeltd

When you visit a website, there’s a lot more going on behind the scenes than you might think and one of the most important processes that takes place is caching. Before we delve into the concept of cache, it’s worth knowing what actually happens when you visit a website as this will allow to better understand the value of caching…

What happens when you visit a website?

Let’s start from the moment you press enter after you’ve typed a website address in the browser, but it’s just the same process however you load a web page. The very first thing that happens, presuming you’re connected to the internet, is the domain is looked up in one or more domain name servers to determine the IP address of the webserver the website is on. The web browser can then send a request directly to the server based on the URL you’re visiting along with any data you’ve inputted through forms.

Once a server receives a request, the web browser then needs to wait for at least a response code. The response code indicates whether further data is going to be sent. In most cases the response code will be 200, which basically means success – the webpage exists and is available. Following a 200 code, the server will send data for the browser to display: typically this consists of HTML code, CSS and Javascript but it could be anything from a simple plain text to a large file.

When the browser has received the response from the server, it will then render or output the content in the most appropriate way. However, it’s not often a web page consists of just one file and it’s likely some of those files will be hosted on different servers. The process described above happens for each file that’s included on the page and although we’re talking milliseconds for each file, the time soon adds up and larger files do take longer to be retrieved, as you might expect.

In general, this means the bigger/more advanced/more complicated the website, the more resources that your browser has to fetch and process – creating a dilemma. Your website needs to not only serve as your digital shopfront but also offer functionality to customers, however, search engines are increasing their expectations for shorter load times as are your website visitors. This is precisely why cache is so important.

What is caching?

Caching is the process of storing data in a temporary location for quick access at a later point of time. When we say a temporary location, it is slightly misleading as most often data will remain there until the cache is cleared or no longer has sufficient capacity. Caching can take place on the server the website is hosted on or by your web browser, or most commonly both. Both the server and your web browser will store frequently accesses resources, or at least parts of them, in their cache.

For the server, the advantage of this is it can respond to requests and serve content faster. The advantage of your web browser caching content is that it needs to make fewer requests to load websites you commonly visit, allowing them to load much faster than usual.

When cache is a pain in the a**

It’s hard not to like caching as it is very effective at what it sets out to do and for the average user it’s hard to find a downside. With that said, if you ask a developer what caching is most will describe it as something along the lines of a necessary evil, for one simple reason. Changes. 

Because of the way caching works, it assumes content remains the same. To be clear, by content we’re not talking about text rather things like images, styles and scripts. In most cases, this is true, especially for long-established websites, and web servers can set a lifetime for a resource to prevent it remaining in the cache for too long.

However, sometimes developers need to make changes to a resource for a number of reasons. When this happens it’s often the case the changes don’t immediately take effect and it can be difficult to force the cache to update the specific resource without asking visitors to completely empty it. This also happens if frequent changes need to made, a common scenario when developing a website. 

When does your cache update

Sometimes, you’ll need to update your cache in order to view changes. It’s something that our clients have to do from time to time when we work on their websites or cloud-based apps, and whilst we can clear server-side cache, unfortunately, the webserver has very little control over your browser’s cache.

Browser’s know which cached file to use by comparing it with the URL of the requested file. By understanding this, it makes sense that if a website’s URL or the URL of the files were to change then the files would not be served from the cache – even if every other aspect were to remain identical. Of course, it’s not practical to change a website’s URL or rename resources any time there is an update.

Your browser’s cache will also update itself periodically, as webservers can stipulate an ‘Expiry Time’ for each file type. For example, most websites set an expiry time of 30 days for images and documents. That means if you’re looking at a web page with an image on, the image will be initially stored in your cache and the image will be served to you from cache any time that you visit the web page over the next 30 days but the next time you visit the website after those 30 days the image will be overwritten in your cache with the current one on the server.

It’s likely that at some point, you’ll need to force a file in your cache to update before it expires. To do this, you’ll need to clear your browser’s cache. Every browser has a different way of doing this, so you can find instructions for your web browser here.

In Chrome, you can also clear the cache for a specific website. To do this, visit the website, right-click anywhere on the page and click ‘Inspect’ – a panel will open either at the bottom or one side of the screen. With this panel open, right-click on the Refresh button and select “Empty Cache and Hard Reload”. You can then close the panel that opened.

As a side note, if you use your browser’s private/incognito mode you’ll be able to load the website with no cache and the cache will be cleared when you close the browser window. However, the cache for the website will not be changed or cleared when you use the browser in ‘normal’ mode.

Category iconWebsites

Let's chat!

We'd love to be able to help you. Even if you've only got an idea or would just like some advice, please do get in touch. We're in the business of helping other businesses go from zero to hero...

We'll pop the kettle on.

Contact us

Footer

Lyke Ltd.

Bespoke digital solutions for real life problems.

Lyke Limited
Lyke Limited
5.0
powered by Google
Gregg Sellars
Gregg Sellars
10:26 21 May 20
Lyke... Limited have just finished Quickboxes new website and Andy has been brilliant every step of the way! I would DEFINITELY recommend Lyke as the right company to go to for your next website project. Thank you Andy!read more
Stefan Christie
Stefan Christie
10:56 17 Feb 20
Grea... t to work with Andy, very helpful and goes above and beyond in all aspects of the project!read more
Joanne Smedley
Joanne Smedley
15:29 16 Jan 20
Wow!... Fixed my issues really quickly and also helped with other software to make the custom software work. This was a major problem for us tcosting us several thousand a year. The firm who originally handled it - wouldn't listen to what I wanted, and wanted over £21k to fix an issue I knew could be fixed easier doing it at the "other end" of the problem. They then "patched" the problem, and didn't tell us that the patch was going to increase print costs by 700% so that cost us AGAIN! Andy fixed it for under £2k by actually LISTENING to what we needed and fixing what the actual problem was easily and speedily saving us thousands!read more
Linda sawyer Sawyer
Linda sawyer Sawyer
12:05 21 Aug 19
It... has been amazing to work with Andy, he has worked with me to set up an E- commerce Website, he’s been very helpful all the way through, I couldn’t of asked for a nicer person to work with. My Website is up and running ,it’s amazing, he’s done a brilliant job. I would highly recommend Andy to anyone.😊 I Look forward to working with him in the future.read more
Julie Varley
Julie Varley
08:28 01 Aug 19
Andy... has been a joy to work with. He has updated our company website to a highly professional standard at an extremely fair price. I have had no problem in contacting Andy for any ongoing advice and support and I would certainly recommend him to any one who is looking to update or improve their online presence just as we have.read more
Lincolnshire CF
Lincolnshire CF
20:31 19 Jun 19
Amaz... ing service, yet again, from Andy. He really does go above and beyond to support clients. Thank youread more
Karen Kennedy
Karen Kennedy
12:20 14 May 19
Afte... r working with Lyke Ltd for over 3 years, we are more than happy to recommend Andy. Not only has he worked on our website but he has also developed some very useful estimating software for our sales and estimating team. It also helps that Andy is professional, kind and has a huge amount of patience with those of us with just enough tech knowledge to do a considerable amount of damage.read more
a16makesomenoise .
a16makesomenoise .
18:41 22 Dec 18
Andy... at Lyke Ltd is amazing! Our previous internet Webmaster had issues... so we asked Andy for help! We asked for what we thought was an impossible task, with no time it which to do it, just days before Christmas! And Andy has Amazed us, he is calm under pressure, reassuringly focused, and very determined when presented with a challenge! Thankyou Andy, we are really looking forward to working with you to develop our Website, online store, gallery and promotional material. We feel like we've found a diamond!read more
See All Reviews

Important Links

  • Home
  • Case Studies
  • The Latest
  • Contact Us
  • About
  • Knowledge Base
Lyke Limited is a company registered in England & Wales (07385687). Registered office: 3 Kaymile Close, DN36 4YB
  • Facebook
  • Twitter

Copyright © 2021 Lyke Ltd. All rights reserved. Return to top