0
0
HLDsystem_design~10 mins

Cache-aside pattern in HLD - Interactive Code Practice

Choose your learning style9 modes available
Practice - 5 Tasks
Answer the questions below
1fill in blank
easy

Complete the code to describe the first step in the cache-aside pattern.

HLD
When a request comes in, the system first checks the [1] for the data.
Drag options to blanks, or click blank then click option'
Adatabase
Bnetwork
Ccache
Dfilesystem
Attempts:
3 left
💡 Hint
Common Mistakes
Confusing cache with database as the first data source.
Assuming data is fetched directly from the network.
2fill in blank
medium

Complete the code to describe what happens if data is not found in the cache.

HLD
If the data is not in the cache, the system fetches it from the [1].
Drag options to blanks, or click blank then click option'
Aclient
Bdatabase
Ccache
DAPI gateway
Attempts:
3 left
💡 Hint
Common Mistakes
Trying to fetch data again from the cache.
Assuming data comes from the client or API gateway.
3fill in blank
hard

Fix the error in the description of updating the cache after fetching data.

HLD
After fetching data from the database, the system [1] the cache with the new data.
Drag options to blanks, or click blank then click option'
Aupdates
Bdeletes
Cignores
Dinvalidates
Attempts:
3 left
💡 Hint
Common Mistakes
Thinking the cache should be invalidated or deleted after fetching data.
Ignoring the cache update step.
4fill in blank
hard

Fill both blanks to complete the cache-aside pattern steps for a write operation.

HLD
When data is updated, the system writes to the [1] first, then [2] the cache to keep it consistent.
Drag options to blanks, or click blank then click option'
Adatabase
Breads
Cinvalidates
Dwrites
Attempts:
3 left
💡 Hint
Common Mistakes
Writing to the cache before the database.
Not invalidating the cache after a write.
5fill in blank
hard

Fill all three blanks to complete the cache-aside pattern read flow with cache miss handling.

HLD
On a cache miss, the system fetches data from the [1], then [2] the cache, and finally [3] the data to the client.
Drag options to blanks, or click blank then click option'
Adatabase
Bupdates
Creturns
Dinvalidates
Attempts:
3 left
💡 Hint
Common Mistakes
Invalidating the cache instead of updating it on a cache miss.
Returning data before updating the cache.