Cache Conundrum: A Daily Dialogue in the World of Code and QA
Tags: webdev, cache, softwaredevelopment, qa
Published: 2024-01-20 07:26:59

I recently wrote 📝 a post on LinkedIn where I discussed the  everyday conversation that I have in my office 💼 with the QA team,some engineers, and project managers.🤝🚀

![LinkedInPost](https://dev-to-uploads.s3.amazonaws.com/uploads/articles/ym6kvz76mfqnmrnt8804.png)

[Here is my linkedIn Profile.](https://www.linkedin.com/in/jagroop-singh-3a2a401b4/)
From that post 📝, I had an idea 💡 to create a blog about it so that they might grasp what developers 🖥️ view as cache.

So let's get started with that: 

> **A cache** is a hardware or software component placed in the memory of an application or device that automatically and temporarily saves data consumed by the user in order to reduce the time and effort required to retrieve data the next time the programme or device is used.


Oh..., there are a **lot of technical jargon** 🤯. Don't worry, let's explain this through the narrative of Prince Kim and Princess Rose. 🤴🌹✨

Prince Kim 🤴 from the kingdom of Utopia likes Princess Rose, whom he met at their kingdom's Party. He wanted to marry her after that, but she refused. 
So Prince Kim assigned his best friend Jin to deliver his letters 📜💌 to her.Every day, Jin goes to Rose's kingdom and transfers the letter 📜💌 to her, receiving a reaction of **'NO'** ❌ and relaying this message to Prince Kim.
Jin must travel to Princess Rose's kingdom on a daily basis to receive her response, which is **'NO'** ❌, as expected. So Jin discovers the pattern in which she consistently says **'NO'** ❌. So rather than going to Rose's kingdom, which is extremely far away, he assumes from her prior response and says **'NO'** ❌ to prince.

That's what caches do. **Jin acts as a cache**, storing Rose's prior responses in his memory, reducing the need for effort to obtain a response from her🌹✨.

_However, it is likely that she changed her mind in the span of time, but owing to the cache, the true reaction of Princess Rose was never revealed to Price Kim._

There are additional sorts of caches, however I will discuss the one that QA and developers typically encounter during testing or development: 

- _Browser Side Cache_ 
- _Server Side Cache_

> **Browser Side Cache:**
> A browser cache is a temporary storage space on your computer or device that keeps copies of web pages and associated files (such as pictures, scripts, and stylesheets) that are frequently requested by web servers.

**Why it's important:**
This is significant since some files, graphics, and code never change, and it is costly to request the server even while the content remains constant. If it is not available, it will send unnecessary requests to the server, and consuming resources.

**Why it's problem at the same time :**
I'll illustrate this with an example. For example, in some e-commerce websites, if the image of the product with the price is cached, and the price or image changes in the future, it may deduct more money and produce a different product than planned, causing an issue for that user even it is not.

**To whom this happened :**
- Those that use that website constantly without taking a break (usually testers do, hence they encounter this difficulty the most)

**How to get rid of this:**
- Always remove cache, cookie,localstorage,sessionstorage etc . before using.
- Pressing `Ctrl+f5` or `Ctrl + Shift + R`
- Using Cache clear browser extension.

> **Server Side Cache:**
> Server-side caching is a strategy for improving the performance and efficiency of online applications that involves storing frequently requested data or computed results on the server. This lets the server to serve subsequent requests for the same data more rapidly by retrieving the cached information rather than recomputing or downloading it again.

**Why it's important :**
Server-side caching is essential for web applications because it increases speed by lowering response times and server load, resulting in a more scalable and responsive user experience.

**Why it's problem at the same time :**
It's not a problem as without that it's very difficult to provide fast results.

**To whom this happened :**
- To everyone (tester's , real user's etc.) because Server is serving cached response instead of updated response.

**How to get rid of this:**
We have the option of clearing the cache, and it varies depending on the server provider.


That’s all in this blog.🌟 Cheers to the adventure that awaits and the stories yet to unfold! 🚀✨