Skip to content

Refetch when new ttl would override cached value #625

Closed Answered by arthurfiorette
jodoox asked this question in Q&A
Discussion options

You must be logged in to vote

Hey @jodoox, I think I understood your requirements correct. override seems to be a pretty good case of this usage. Override does not ignores cache completely, cache: false does. You could do the following:

const id = 'some-id';
const currentStorage = await axios.storage.get(id)
const isCacheOlderThan30Min = myLogic(currentStorage);
axios.get('url', { id, cache: { override: isCacheOlderThan30Min } });

This should only define override: true when the current cache is older than 30min, in which case, as the override spec says, would ignore current cache and proceed to request in the network, however it does not deletes or ignore cache/fallbacks mechanisms, which is something you should care …

Replies: 1 comment 1 reply

Comment options

You must be logged in to vote
1 reply
@jodoox
Comment options

Answer selected by arthurfiorette
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants