Code Monkey home page Code Monkey logo

Comments (3)

The-Redhat avatar The-Redhat commented on August 16, 2024

I think that's because how the library works. The cache manger only updates a file when the file is expired (validTill is before the actuall date). When it updates a file it then uses the Etag to determine if there is a newer file on the server. The cache headers include a tag must-revalidate that manages such stuff but the library doesn't support that.

from flutter_cache_manager.

renefloor avatar renefloor commented on August 16, 2024

Indeed, the library only checks if the file is up to date when the max-age is passed and so the cache is expired. If the etag is still the same it updates the age, otherwise the file is refreshed.

About the must-revalidate:
"Because a cache MAY be configured to ignore a server's specified expiration time, and because a client request MAY include a max- stale directive (which has a similar effect), the protocol also includes a mechanism for the origin server to require revalidation of a cache entry on any subsequent use. When the must-revalidate directive is present in a response received by a cache, that cache MUST NOT use the entry after it becomes stale to respond to asubsequent request without first revalidating it with the origin server. (I.e., the cache MUST do an end-to-end revalidation every time, if, based solely on the origin server's Expires or max-age value, the cached response is stale.)"
So must-revalidate only says that a cache has to revalidate when a cache is expired, this is normally optional.

As far as I know this library follows the defined http logic. If you want to get the update faster set the max-age lower.

from flutter_cache_manager.

shabanov-krl avatar shabanov-krl commented on August 16, 2024

@renefloor

Web browsers check the etag every time a file is requested and update the cache if the etag does not correspond to what is in the cache.

Why can't this package do the same?

I need the cache to be updated if the image has changed on the server.

from flutter_cache_manager.

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.