0

I want to cache objects of custom claas, which implements serializable using LRUCache in android. It is possible? If yes, how can I proceed to do the same?

Pankaj Deshpande
  • 502
  • 2
  • 5
  • 15

1 Answers1

1

LruCache has the syntax of that of a Map i.e LruCache key value pair. I can't see any reason why you can't store objects of Custom class in it. It will behave like a Map. On the other hand LruCache is generally used to cache bitmaps.

V4Vendetta
  • 11
  • 1
  • Finally I succeed in adding object in disk cache. I was directly writing the serialized object into cache; it was storing also; but when application restarts, that object was getting cleared from cache. So I wrote that object in file using ObjectOutputStream and it worked! – Pankaj Deshpande Jul 18 '13 at 14:15