SizeBasedEnhancedLruCache

Additional

Language
Java
Version
N/A
Created
Mar 23, 2017
Updated
Mar 24, 2017
Owner
Mykyta Sizyntsev (Ufkoku)
Contributor
Mykyta Sizyntsev (Ufkoku)
1
Activity
Badge
Generate
Download
Source code

Show card

Lib overrides android.support.v4.util.LruCache and uses code from article to measure size of objects in heap.

repositories {
    maven { url 'https://dl.bintray.com/ufkoku/maven/' }
}

dependencies {
    compile 'com.ufkoku.cache:lru_cache:1.0.0'
    //or
    compile ('com.ufkoku.cache:lru_cache:1.0.0@aar'){
        transitive = true
    }
}

Usage:

SizeBasedEnhancedLruCache<String, Object> cache = new SizeBasedEnhancedLruCache<>(sizeInBytes);