It is to ๐ฐ๐ฎ๐ฐ๐ต๐ฒ (๐ฎ๐น๐บ๐ผ๐๐) ๐ฒ๐๐ฒ๐ฟ๐๐๐ต๐ถ๐ป๐ด! Caching stores copies of frequently accessed data in a readily accessible location, reducing access time and offloading primary data sources.
Advantages of caching are faster data retrieval, reduced load on primary data stores, and improved user experience.
Don't cache only database queries, as reading for cache is much faster than an API call.
How do you ๐ฑ๐ฒ๐ฐ๐ถ๐ฑ๐ฒ to cache something? The better question is, why not cache something?
Adding a cache comes with costs, so for each candidate, we need to ๐ฒ๐๐ฎ๐น๐๐ฎ๐๐ฒ the following:
๐น Is it faster to hit cache?
๐น Is it worth to store?
๐น How often do we need to validate?
๐น How many hits per cache entry will we get?
๐น Is it local or shared cache?
Yet, cached data is stale, so there can be situations in which it is inappropriate.
To determine how successful your cache is, you can keep an eye on metrics like cache misses.
There are ๐ฐ๐ฎ๐ฐ๐ต๐ถ๐ป๐ด ๐๐๐ฟ๐ฎ๐๐ฒ๐ด๐ถ๐ฒ๐:
๐ญ. ๐๐ฎ๐ฐ๐ต๐ฒ-๐๐๐ถ๐ฑ๐ฒ: The application manually manages data storage and retrieval from the cache. Data is fetched from the primary storage on a cache miss and then added to the cache.
๐ฎ. ๐ฅ๐ฒ๐ฎ๐ฑ-๐ง๐ต๐ฟ๐ผ๐๐ด๐ต: When a cache miss occurs, the cache automatically loads data from the primary storage. It simplifies data retrieval by handling cache misses internally.
๐ฏ. ๐ช๐ฟ๐ถ๐๐ฒ-๐๐ฟ๐ผ๐๐ป๐ฑ: Data is written directly to the primary storage, bypassing the cache. This strategy is effective when writes are frequent, and reads are less common.
๐ฐ. ๐ช๐ฟ๐ถ๐๐ฒ-๐๐ฎ๐ฐ๐ธ: Data is first written to the cache and later synchronized with the primary storage. This reduces the number of write operations but risks data loss if the stock fails before syncing.
๐ฑ. ๐ช๐ฟ๐ถ๐๐ฒ-๐ง๐ต๐ฟ๐ผ๐๐ด๐ต: Data is simultaneously written to both the cache and the primary storage, ensuring consistency but potentially increasing write latency. Ideal for scenarios where data integrity is crucial.
Do you use caching?
#softwaredesign
To expand your knowledge and personal growth, subscribe to my free weekly newsletter with 20,000+ people: .newsletter.techworld-with-milan.com
โข โข โข
Missing some Tweet in this thread? You can try to
force a refresh
C# language has been developing for more than 20 years now. Yet, every year, we see new versions of the language with new, exciting features. Some of their features aren't just updates but tools that can drastically enhance your coding efficiency and software design.
Here is an overview of the main C# features from C# 6 to 12, released last week. You can check a short explanation and ๐ฎ ๐ฐ๐ผ๐ฑ๐ฒ ๐๐ป๐ถ๐ฝ๐ฝ๐ฒ๐ ๐ณ๐ผ๐ฟ ๐ฒ๐๐ฒ๐ฟ๐ ๐ณ๐ฒ๐ฎ๐๐๐ฟ๐ฒ (more than 40 most important features!).
We are all familiar with GoF Design Patterns which represent a general reusable solution to some occurring problems in software design. They are templates for how to solve a problem that can be used many times,โฆ https://t.co/BlBIOrYiQrtwitter.com/i/web/status/1โฆ
In his latest talk at Clojure Conj 2023., Rick Hickey, a creator of Clojure, talked about some great techniques to create a great software design in practice.
We all struggle with the things we should do next and what to prioritize. Here comes the ๐๐ฒ๐๐๐ถ๐ป๐ด ๐ง๐ต๐ถ๐ป๐ด๐ ๐๐ผ๐ป๐ฒ (๐๐ง๐) ๐ณ๐ฟ๐ฎ๐บ๐ฒ๐๐ผ๐ฟ๐ธ to help.
It was developed by David Allen in the 1990s and the main idea behind GTD is that by getting all of your tasks and commitments out of your head and into a trusted system, you can reduce stress, increase productivity, and free up mental space to focus on more important things.
So, how it works is to have the following ๐น๐ถ๐๐๐:
๐ญ. ๐๐ป. Here we put all ideas we have as they occur. Write down every task, or idea that comes to mind, no matter how small or insignificant. When you are adding items here, you should ask yourself if this is actionable.