This repository was archived by the owner on Mar 16, 2019. It is now read-only.
This repository was archived by the owner on Mar 16, 2019. It is now read-only.
simple caching layer case, not possible? #246
Open
Description
I'm trying to implement a very simple caching layer:
function myFetch(url, invalidate) {
if (!invalidate) {
return FetchBlob.config({ fileCache: true, key: 'cache'+url }).fetch('GET', url);
} else {
// ...?
}
}
How would I instruct FetchBlob not to look at the FS when making the request, but saving the result there none the less? I don't want to delete the cache file beforehand (which would be tedious btw, because I need to copy the md5 behavior of the key->path implementation?!), because if the request fails I still want to keep the stale version.
Any thoughts?