-
-
Notifications
You must be signed in to change notification settings - Fork 288
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Using GetOrFetchObject never seems to invalidate objects #87
Comments
Maybe I'm just using it wrong? I have a project here: https://github.com/TheAngryByrd/GetOrFetchProblem/ If you notice in the Mainpage.xaml.cs, the OnNavigatedTo demostrates what i'm trying to do. I call : var value = await BlobCache.LocalMachine.GetOrFetchObject("key", () => GetThing(), DateTimeOffset.Now.AddSeconds(10)); and it will write out the console when GetThing() gets called and when it returns a value. Now if you stop the app, wait 10 seconds and open it back up, it never seems to call GetThing() again. |
I think I know what's happening. You're killing the app via the Stop button, and you're using the deprecated backend (i.e. not SQLite3) - when you do this (and you don't Dispose BlobCache on shutdown), Akavache doesn't flush the metadata so it loses the expiration. |
Here's the 411: https://github.com/github/Akavache/blob/master/Akavache/PersistentBlobCache.cs#L104 We need at least 30sec of idle time before we'll attempt to flush the cache. If you make a bunch of writes then immediately kill it and you don't shutdown the blob cache properly, you'll see this. The way to shut it down is: BlobCache.LocalMachine.Dispose();
await BlobCache.Shutdown; |
Ok awesome. I'll make sure to do that. Or maybe I'll move to using sqllite. Thanks! |
Using thee GetOrFetchObject for operations that write to disk, it never seem to invalidate using the absolute expiration.
The text was updated successfully, but these errors were encountered: