Caching
Why?It ensures low latency and high throughput.
What? Disk-based -> RAM(Random Access Memory)
Caching Dynamic Data
It has expiry time or TTL. Cache invalidation to purse expired data.
Caching static data
Images, Font files, CSS. Not changed often. CDNS
Application architecture cache can be used
Prevent unnecessary network requests with the HTTP Cache
cross-module communication in a microservices architecture by saving the shared data
a backbone for the microservice communication.
Used in in-memory data stream processing and running analytics.
Case study: Deployment costs reduction
Caching the writes in Memchae thendo a batch operations to update DB. (Write-back strategy)
Caching strategies
Cache Aside
lazy-loaded, the cache works along with the database trying to reduce the hits on it as much as possible
Read-Through
the cache always stays consistent with the database.
Write-Through
each & every information written to the database goes through the cache. Before the data is written to the DB, the cache is updated with it.
Write-Back
In the Write-back caching strategy the data is directly written to the cache instead of the database. And the cache after some delay as per the business logic writes data to the database.