Discuss

Caching API Data

On this page

Sometimes data APIs have restrictions like limits for requests per IP or hourly request limits. In cases like these, it's useful to have data cached for your user. You can do this by using the state management component in Wappler.

In App Structure add new component:

Screenshot_1|690x429

Then open the State Management category. In this tutorial we will show you how to cache the data in the local storage, but you can also store it in a session if you like. So - we select local storage manager:

Screenshot_2|690x429

Then, select your API Data Source and in the properties select the local storage manager we just created:

Screenshot_3|690x429

Add the time to cache your data for (in seconds) and you are done:

Screenshot_4|690x429

Now, when our users reload the page in the next 3600 seconds, the API won't be called and the data will be loaded from the local storage.


WapplerPrevious|101x31   WapplerNext|77x31