Cache: It's Still Useful!
If you're a layman, you might not heard about what a "cache" is. Actually, it's just storing some results, usually temporarily, that's takes a long time to generate. For example, mathematicians, physicists, and other scientists in their fields have lots of calculations to go through, and it's easier if they don't need to recalculate everything from the start, so they cache results as a checkpoint. Another example, if you play a game, it would be stupid if you need to restart the game every time. The "save" feature allows you to checkpoint where you left and continue from there.
But the above examples doesn't exactly mean "cache", it means more like "checkpoint". Cache is more technical. For example, your computer have cache on things that needs to be fetched really quickly, and by real quick it means there's no time to calculate. Think of trying to beat the time when you're in an exam, you don't have time to think on your feet, so you need to have something that's readily written, otherwise you would be out of time. Hopefully this gives you some idea about caching.
Then, why do we say cache is still useful? And why would it be not useful. Particularly, let's talk about playing games. If you're a game maker, particularly a lighting designer, you know something about "ray tracing". Or maybe you own an RTX card (starting from the 20 series of NVIDIA), and that "RT" in "RTX" means "ray tracing". It means, finally, we got a powerful enough graphic card that could calculate ray tracing in real time without caching. Before that, including a Titan X or a GTX 1080 Ti, it's incapable of real-time ray tracing, and some cache is required to smoothly play the game, and that's called shader cache.
Shader is a professional word too. You could treat it as the scene/image of that you can see with your eyes when you play a game (even though that's not exactly it). What shader cache does is, when it renders a "frame" of the game, it saves this frame inside a cache so the next time you need it, it could be fetched from your disk. This way, it's faster than re-calculating the scene from scratch. You might be playing games at 10 FPS without a shader cache, if you doesn't have an RTX card; but with shader cache, you could play at 30 FPS, as an example. (You need a strong-enough CPU though to fetch the cache)
And thinking about it, if we make a game that doesn't implement shader cache, it means that we are conveying to our customers, our players, that they must buy a strong-enough hardware components (CPU, graphic cards, RAM, very-fast-SSD) to play it smoothly, and close the door to the lesser players. It's quite a arrogant design. Therefore, we may assume that our players may only have GTX 750 and design a game that, with a shader cache, could play.
Similarly, one was doing some programs recently with database. If you followed me, you know one loves Ruby on Rails. And most Rails application uses the PostgreSQL database; but PostgreSQL have one limitations: trying to SELECT DISTINCT is slow if you have millions of records. These aren't a problem in MySQL, provided the latter have some "technologies" that implements them. In this case, we have two choices: one is switch to MySQL, another is, as you've gussed, implement a distinct cache. Switching to MySQL does solve the problem, at the cost of writing things from scratch as there aren't as much support (libraries/gems) from the community for MySQL as PostgreSQL does in Rails.
As for a distinct cache, its similar to shader cache. When the database is updated, you run the SELECT DISTINCT once and save it into a distinct cache database. Sure, that does create an extra table to save stuffs, and takes up slightly more space (if what "distinct" you want isn't "too distinct" that it have "too many choices"). However, it does saves the time querying millions of billions of records without having to switch database. Some of you might think that it's dirty. Personally, I don't think so. It's an implementation that's innovative.
So, we have looked at how cache works today, and we understand that, to be not too arrogant, cache still have its way in the world. We can't expect everyone to have the latest and strongest set of hardware components, and cache is still active today.
Remember to Like and Subscribe!