
"The Grab Android app used Glide as its primary image loading framework, including an LRU cache to store images locally in order to reduce network calls, improve load times, and lower server costs. However, analytics showed that using a 100 MB LRU cache had significant shortcomings: it often filled up quickly for many users, leading to performance degradation, while in other cases images remained cached for months if the cache never exceeded the size limit, thus wasting storage."
"To circumvent these limitations, they decided to extend LRU with time-based expiration. TLRU uses three parameters, Time To Live (TTL), which determines when a cache entry is considered expired; a minimum cache size threshold, which ensures essential images remain cached even when they expire if the cache is underpopulated; and maximum cache size, which enforces the upper storage limit."
"Instead of implementing TLRU from scratch, Grab engineers chose to fork Glide and extend its DiskLruCache implementation, leveraging its "mature, battle-tested foundation" This implementation is widely adopted across the Android ecosystem and handles complex edge cases like crash recovery, thread safety, and performance optimization that would require substantial effort to replicate."
Grab's Android app initially used an LRU cache with Glide for image loading to reduce network calls and server costs. However, analytics revealed significant limitations: the 100 MB cache filled quickly for some users causing performance degradation, while for others images remained cached for months, wasting storage. To address these issues, Grab extended LRU with time-based expiration, creating TLRU. This system uses three parameters: Time To Live for expiration timing, a minimum cache size threshold to preserve essential images, and a maximum cache size limit. Rather than building from scratch, engineers forked Glide and extended its DiskLruCache implementation, leveraging its proven foundation and built-in handling of edge cases like crash recovery and thread safety.
#android-cache-management #time-aware-lru-cache #image-loading-optimization #storage-efficiency #glide-framework
Read at InfoQ
Unable to calculate read time
Collection
[
|
...
]