This post details how Grab evolved their Android image caching from LRU to TLRU (Time-Aware Least Recently Used) to reclaim storage without degrading user experience.
- •The LRU disk cache was capped at 100 MB, with P90 users constantly hitting the limit while stale images persisted below it.
- •TLRU introduces three attributes: TTL for expiration, a minimum cache size threshold to protect essential content, and the inherited maximum size limit.
- •An entry is expired if (current_time - last_accessed) > TTL; eviction only occurs when cache stays above the minimum threshold.
- •The implementation cloned Glide's DiskLruCache and extended it with time-based eviction, preserving thread safety and crash recovery.
This summary was automatically generated by AI based on the original article and may not be fully accurate.