Giter Club home page Giter Club logo

Comments (5)

anaisbetts avatar anaisbetts commented on May 20, 2024

How are you testing that it's not invalidating?

from akavache.

TheAngryByrd avatar TheAngryByrd commented on May 20, 2024

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.

from akavache.

anaisbetts avatar anaisbetts commented on May 20, 2024

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.

from akavache.

anaisbetts avatar anaisbetts commented on May 20, 2024

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;

from akavache.

TheAngryByrd avatar TheAngryByrd commented on May 20, 2024

Ok awesome. I'll make sure to do that.

Or maybe I'll move to using sqllite.

Thanks!

from akavache.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.