apipeline
apipeline copied to clipboard
Caching
I was wondering looking at the flowchart how the caching data is checked for stale state ?
It solely depends on the age of the stored data.
If you set your expiration to one hour and if your data for the endpoint you're trying to reach is two hours old, it will be considered as stale.
So, if you have some connectivity, it will refresh your data and if you don't, it will return the stale one.
It doesnt update cache with this settings if i have connectivity
const API_OPTIONS = {
fetchMethod: fetch,
domains: { default: 'http://demo4345133.mockable.io' },
prefixes: {default: '/spica'},
debugAPI: true,
printNetworkRequests: true,
};
const API_SERVICES = {
auth: {
method: 'POST',
path: 'auth',
rawData: true,
},
getStorageDefs: {
method: 'POST',
path: 'storage-defs',
rawData: true,
expiration: 5 * 60 * 1000
},
};
const apiPipeline = new APIpeline(API_OPTIONS, API_SERVICES, AsyncStorage);
Up @Exilz