jakewharton/disklrucache — explained in plain English
Analysis updated 2026-06-26
Cache downloaded images in an Android app so they load instantly on the next open without hitting the network again.
Store API responses like JSON to disk so your app works offline or starts faster after the first run.
Save computed results that are expensive to recalculate, reading from disk instead of reprocessing every time.
| jakewharton/disklrucache | ddd-by-examples/library | nightonke/boommenu | |
|---|---|---|---|
| Stars | 5,790 | 5,786 | 5,786 |
| Language | Java | Java | Java |
| Setup difficulty | easy | moderate | easy |
| Complexity | 2/5 | 4/5 | 2/5 |
| Audience | vibe coder | developer | developer |
Figures from each repo's GitHub metadata at analysis time.
Add the Maven or Gradle dependency, call DiskLruCache.open() with a directory and size limit, then use put/get with string keys.
DiskLruCache is a Java library that saves data to the device filesystem and keeps the total size of that data within a limit you set. When stored data exceeds the limit, the library automatically removes old entries in the background until it fits again. The entries it removes are the ones that have not been accessed recently, which is the meaning of LRU (least recently used). This kind of cache is useful in Android apps when you want to avoid re-downloading or re-computing expensive data on every launch. Instead, you store the result the first time, and on the next run you read it from disk rather than fetching it again. The README notes that the implementation specifically targets Android compatibility. Each item in the cache is identified by a string key. You store values as raw byte sequences, which means you can cache anything from downloaded images to JSON responses to computed results. Reading a cache entry gives you a snapshot of the data at the moment you requested it, any updates happening at the same time do not affect your read. Writing is atomic too: if you commit a change, readers will see either the old data or the new data, never a partially written mix. The library handles some types of filesystem errors gracefully. If a cached file goes missing, the library drops that entry and moves on. Write errors fail without crashing your application. The library is available through Maven and Gradle for standard Java and Android projects. It is authored by Jake Wharton and based on an original implementation from the Android Open Source Project. It is released under the Apache 2.0 license.
A Java library that saves data to disk and automatically evicts the oldest entries when a size limit is reached, so Android apps avoid re-downloading or re-computing expensive data on every launch.
Mainly Java. The stack also includes Java, Android, Maven.
Apache 2.0, free to use, modify, and distribute in personal or commercial projects. Just keep the license notice.
Setup difficulty is rated easy, with roughly 30min to a first successful run.
Mainly vibe coder.
This repo across BitVibe Labs
Verify against the repo before relying on details.