kittinunf / Fuse

The simple generic LRU memory/disk cache for Android written in Kotlin

Home Page:https://kittinunf.gitbook.io/fuse/

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Memory cache sizing

moagrius opened this issue · comments

Nice job on the library!

When looking at MemCache.kt, line 9https://github.com/kittinunf/Fuse/blob/master/fuse/src/main/kotlin/com/github/kittinunf/fuse/core/cache/MemCache.kt#L9, I can see that you're setting the size of the cache to 1/8th of the avialable memory, as is described here: https://developer.android.com/topic/performance/graphics/cache-bitmap.html#memory-cache

However, you're not overriding sizeOf, so I believe you'll accept a number of items equal to that value, rather than the number of kilobytes.

Or did I miss something?

Wow! you are right! I think my original implementation is not correct. I will find time to correct it, if you feel fancy you can open a PR for them too.

PR'ed #11

New version of Fuse allows users to supply their own implementation of LruCache

For example,

defaultAndroidMemoryCache(object : LruCache<String, Any> () {

})

So, I don't think this is an issue anymore! I know that this is long overdue but please try new version 🙏