Reclaiming Terabytes: Optimizing Android image caching with TLRU
Mar 6, 2026Nguyen Van Minh

Summary
This post details the implementation of a Time-Aware Least Recently Used (TLRU) cache by extending Glide's DiskLruCache. The TLRU cache introduces Time-To-Live (TTL) for automatic eviction of stale content, a minimum cache size threshold to protect essential images, and retains the maximum cache size for storage management. The technical implementation involves cloning and modifying DiskLruCache to incorporate these time-based eviction rules, alongside size-based eviction and minimum threshold protection.