chrisben / imgcache.js

JS library based on the File API to cache images for offline recovery (target: cordova/phonegap & chrome)
Other
826 stars 216 forks source link

Does ImgCache.isCached detect a file content change? #238

Closed DaveLomber closed 5 years ago

DaveLomber commented 5 years ago

Does 'ImgCache.isCached' detect a file content change?

I mean if we have the same url, but the file contact has changed, does this method return 'false' in this case or still 'true'?

If still 'true' - how we can deal with it?

chrisben commented 5 years ago

It means a cached version of that file exists in the filesystem. If only the content has changed and the path is the same, isCached has no idea the content is different, and will only tell you if a cached file exists for that path. The hash we use is only there for the path, not for the content.

Detecting a change of content is outside of the scope of this library because it would require to download the file again, when? how often? why? ... It's up to your business logic to define all this, this library is only the tool doing the caching bit.