3

I am using Akavache for a cache of local objects. I'd like to be able to delete everything in the database (so it is as if it was the first time the program was run). I've seen the Vacuum method, but that only removes old items that have expired. What is the easy way to clean everything up?

Gordon
  • 2,600
  • 2
  • 21
  • 31

2 Answers2

5

@SmartyP and @fenix2222,

I had to do the following to permanently remove the data:

BlobCache.LocalMachine.InvalidateAll();
BlobCache.LocalMachine.Vacuum();

It appears as though InvalidateAll() essentially marks everything as expired, but you still must use Vacuum() to remove the expired items.

dbarton91
  • 83
  • 2
  • 7
4

Turns out it is right there, I just couldn't see it!

BlobCache.UserAccount.InvalidateAll();

Does the trick!

Gordon
  • 2,600
  • 2
  • 21
  • 31
  • 1
    I've noticed that this doesn't seem to actually persist that clearing to the database. Running the app again without calling this will pull back the same cached data from before InvalidateAll() was called. I tried to use both Flush() and Vacuum() after the InvalidateAll() call with no luck. Only uninstalling the app or changing the cacheing key would let me stop using the cached data without calling InvalidateAll() each time. – SmartyP Oct 02 '15 at 17:53
  • Interesting. In my win 8.1 app the data is gone forever. You might try writing a tiny test case that. Is tally isolated and see if it happens there? For my app I am using Rx and as a result there was lots of stuff going on at once and I had a lot of trouble debugging things like this. :( – Gordon Oct 03 '15 at 20:00
  • @SmartyP It is an old post, but have you found a way to clear the data. No matter what I do, it comes back after next deployment – fenix2222 May 08 '17 at 11:25
  • @fenix2222, yeah, as you can see, you are the second person to note this. I've not had this problem - the data is just "gone". I wish I could help, and I can't really guess anything but putting together a small test case. :( – Gordon May 12 '17 at 03:56