explaingit

yangfuhai/asimplecache

Analysis updated 2026-07-03

3,664JavaAudience · developerComplexity · 2/5Setup · easy

TLDR

A single Java file that adds disk caching to Android apps, letting you store strings, JSON, images, and objects with automatic expiration so the app does not refetch the same data repeatedly.

Mindmap

mindmap
  root((repo))
    What it does
      Disk caching library
      Single Java file
      Auto expiration
    Data Types
      Strings and JSON
      Bitmaps
      Serialized objects
      Byte arrays
    Use Cases
      Network response cache
      Image caching
      Config storage
    Tech Stack
      Java
      Android
Click or tap to explore — scroll the page freely

Code map

Detail Auto

An interactive map of this repo's files and how they connect — its source is parsed live in your browser. Click Visualize to build it.

filefunction / class

What do people build with it?

USE CASE 1

Cache network API responses in an Android app so the same data loads instantly within a configurable time window.

USE CASE 2

Replace SharedPreferences with ASimpleCache to store richer data types like Bitmaps or JSON arrays.

USE CASE 3

Set auto-expiring cache entries for user avatar images so they refresh once per day without manual cleanup.

What is it built with?

JavaAndroid

How does it compare?

yangfuhai/asimplecachegoogle/rejoinerlisawray/groupie
Stars3,6643,6643,673
LanguageJavaJavaJava
Setup difficultyeasyhardeasy
Complexity2/54/52/5
Audiencedeveloperdeveloperdeveloper

Figures from each repo's GitHub metadata at analysis time.

How do you get it running?

Difficulty · easy Time to first run · 5min

In plain English

ASimpleCache is a lightweight caching library for Android and Java, written in Chinese by developer yangfuhai. The entire library is contained in a single Java file, making it easy to drop into a project without adding a large dependency. It can store several types of data: plain strings, JSON objects and arrays, images (Bitmap and Drawable), serialized Java objects, and raw byte arrays. Each item stored in the cache can be given an expiration time in seconds or days, once the time is up, the item is automatically deleted and any request for it returns null. The cache is also configurable in terms of where files are stored and how many items or how much total space it is allowed to use. It supports access from multiple processes. The README, written in Chinese, describes a few typical Android use cases: using it in place of SharedPreferences for storing configuration, or caching the results of network requests so that the app does not need to fetch the same data again within a short window. The usage example shows creating a cache instance with ACache.get(this), storing a value with mCache.put("key", "value"), and retrieving it with mCache.getAsString("key"). An optional second argument to put sets the expiration duration.

Copy-paste prompts

Prompt 1
Show me how to use ASimpleCache in an Android Activity to cache a JSON API response for 10 minutes and fall back to the network if the cache misses.
Prompt 2
How do I store and retrieve a Bitmap image with a 24-hour expiration using ASimpleCache?
Prompt 3
Write Android code using ASimpleCache to replace SharedPreferences for storing a user settings JSON object with a 7-day TTL.
Prompt 4
How do I configure ASimpleCache to limit total cache size to 50MB on Android external storage?

Frequently asked questions

What is asimplecache?

A single Java file that adds disk caching to Android apps, letting you store strings, JSON, images, and objects with automatic expiration so the app does not refetch the same data repeatedly.

What language is asimplecache written in?

Mainly Java. The stack also includes Java, Android.

How hard is asimplecache to set up?

Setup difficulty is rated easy, with roughly 5min to a first successful run.

Who is asimplecache for?

Mainly developer.

Open on GitHub → Explain another repo

This repo across BitVibe Labs

Scan in gitsafehub Deploy in gitdeployhub yangfuhai on gitmyhub

Verify against the repo before relying on details.