0

I'm trying to understand how to properly use Akavache. I have a List that I store in the Akavache BLOB cache with the key ObjectAKey. I insert it using Akavache's GetOrFetchObject() method. I can recall List from my Akavache BLOB cache by calling Akavache's GetObject() method (or the GetOrFetchObject() method also works).

I don't see any methods to update an object in the cache. Furthermore if I use the InsertObject() method to add more instances of ObjectA to the existing cache (for key ObjectAKey) then it overwrites the existing objects in the cache with the new instance of the object.

Is it possible to update an instance of an object in the existing cache or insert a new instance of an object into that same existing cache for a particular key?

J.D.
  • 954
  • 6
  • 22
  • "it overwrites the existing objects in the cache with the new instance of the object" - isn't this exactly what you want it to do? If you insert an object with an existing key, the new object replaces the existing object. – Jason Dec 23 '20 at 18:58
  • @Jason Actually it's not the behavior that I want, which is the basis of my question because I'm trying to understand the proper use cases for Akavache and what is its behavior. Upon further research, my use case apparently is more in tune with a RDBMS like SQLite and Akavache is the wrong tool for the job. – J.D. Dec 23 '20 at 19:24
  • 1
    This is the wrong tool if you want to maintain your instances in your store. I'd use DynamicData if you want to having a backing list of objects where you are notified if they get updated. – Lee McPherson Dec 23 '20 at 20:40
  • 1
    Akavache is a better tool for storing app settings, downloading and caching images that can have expiration dates, etc. – Lee McPherson Dec 23 '20 at 20:42
  • @LeeMcPherson Thanks, that validates exactly what I thought it was used for! Currently we were experimenting to use it to store other data sets from our relational database, but I'll have to think more about our implementation. – J.D. Dec 23 '20 at 23:17

0 Answers0