Skip to content

Instantly share code, notes, and snippets.

View alexfjw's full-sized avatar
🐢
I may be slow to respond.

Alex Fong alexfjw

🐢
I may be slow to respond.
View GitHub Profile
@alexfjw
alexfjw / ExpiringLruCache.java
Created August 16, 2017 05:08 — forked from christopherperry/ExpiringLruCache.java
LruCache for Android with expiring keys. Instead of modifying LruCache directly I used delegation to get around final keyword usage and a dirty hack to override everything else.
import android.os.SystemClock;
import android.support.v4.util.LruCache;
import java.util.HashMap;
import java.util.Map;
/**
* An Lru Cache that allows entries to expire after
* a period of time. Items are evicted based on a combination
* of time, and usage. Adding items past the {@code maxSize}