Cache Conundrum: A Daily Dialogue in the World of Code and QA

Jagroop Singh - Jan 20 - - Dev Community

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

Here is my linkedIn Profile.
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! ๐Ÿš€โœจ

. . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . . .