apipeline icon indicating copy to clipboard operation
apipeline copied to clipboard

Caching

Open saifkamaal opened this issue 6 years ago • 3 comments

I was wondering looking at the flowchart how the caching data is checked for stale state ?

saifkamaal avatar Dec 25 '18 10:12 saifkamaal

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.

Exilz avatar Dec 27 '18 09:12 Exilz

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);

Villar74 avatar Apr 08 '19 16:04 Villar74

Up @Exilz

Villar74 avatar Apr 30 '19 12:04 Villar74