4

I am trying to cache some data using LruCache in android, say like I have

LruCache<String, SomeDataClass>

And SomeDataClass like

data class SomeDataClass(val data: Any)

My doubt is if am pushing some data to the cache and by the time cache is full, so LruCache will automatically evict the least used item and push the new one.

  1. Is the evicted item will be garbage collected?
  2. Is it safe to use the already fetched item that was evicted now from the cache?

Can anyone help me out with this?

hata
  • 11,633
  • 6
  • 46
  • 69
Stack
  • 1,164
  • 1
  • 13
  • 26

0 Answers0