Swiggy Feb 21, 2023

Handling Multiple Caches in App

Article Summary

Swiggy's mobile team faced a common problem: juggling disk caches, LRU caches, and databases without creating a maintenance nightmare. Here's their elegant solution.

Ravi Gupta from Swiggy's engineering team shares their architecture for managing multiple caching mechanisms (disk, LRU, database) across different asset types like images, Lottie animations, and videos. The approach keeps each layer independent while making it easy to add new cache types.

Key Takeaways

Critical Insight

A clean separation of concerns lets Swiggy mix disk caching, LRU caching, and custom solutions without tight coupling or code changes when adding new cache types.

The sequence diagram reveals how asset requests flow through the system and why this pattern prevents the cache management chaos most teams experience.

Recent from Swiggy

Related Articles