Comments (3)
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.
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.
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)
- Get & list cached files
- CacheManager attempts to create file named guid.* on Windows (full example included and clear description)
- Cached file should be removed on 404, and error should be added to Stream even if a cached file exists
- If image (DOES NOT EXIST) AND (maxWidth/maxHeight) ARE set, the stream never closes
- How to customize the file name
- How can I get the total size of the cache or get the cache path? HOT 9
- Windows fail
- Auto Extend the cached file's longevity if the user views it before it expired.
- The cached files aren't being removed after the stale duration is over! HOT 1
- ClientException: Redirect limit exceeded
- JsonCacheInfoRepository: FormatException: Unexpected end of input (at character 1) ^
- Privacy manifest file for iOS is missing HOT 2
- Stale period not working properly
- Add option to not use SQLite and default to that HOT 3
- v3.3.1 DefaultCacheManager().getSingleFile(url) throws and pauses the app in debug mode, rather than let the error be caught
- Cannot upgrade rxdart to latest HOT 1
- Invalid argument(s): No host specified in URI. Error thrown . HOT 1
- FormatException was thrown
- Proposal to support all platforms (including web) while emulating browser caching behavior HOT 3
- Provide response body for status code 400
Recommend Projects
-
React
A declarative, efficient, and flexible JavaScript library for building user interfaces.
-
Vue.js
🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.
-
Typescript
TypeScript is a superset of JavaScript that compiles to clean JavaScript output.
-
TensorFlow
An Open Source Machine Learning Framework for Everyone
-
Django
The Web framework for perfectionists with deadlines.
-
Laravel
A PHP framework for web artisans
-
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.
-
Visualization
Some thing interesting about visualization, use data art
-
Game
Some thing interesting about game, make everyone happy.
Recommend Org
-
Facebook
We are working to build community through open source technology. NB: members must have two-factor auth.
-
Microsoft
Open source projects and samples from Microsoft.
-
Google
Google ❤️ Open Source for everyone.
-
Alibaba
Alibaba Open Source for everyone
-
D3
Data-Driven Documents codes.
-
Tencent
China tencent open source team.
from flutter_cache_manager.