Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Caching #20

Open
saifkamaal opened this issue Dec 25, 2018 · 3 comments
Open

Caching #20

saifkamaal opened this issue Dec 25, 2018 · 3 comments
Labels

Comments

@saifkamaal
Copy link

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

@Exilz
Copy link
Owner

Exilz commented Dec 27, 2018

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 Exilz added the question label Dec 27, 2018
@Villar74
Copy link

Villar74 commented Apr 8, 2019

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
Copy link

Up @Exilz

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

3 participants