Data Caching

Caching, in general, aims to increase data retrieval performance by saving the data in cache memory and retrieving it from cache upon loading or refreshing the app. This mechanism enables faster load and response times which helps improve efficiency and performance of the application.

We support caching for the following data:

  • Users

  • Comments

  • Messages

  • Posts

If the caching feature is enabled, during data query, the application will load the data from cache if it is still valid without fetching from the server.

To enable or disable caching, use this sample code:

How does caching work?

When a user loads the application or refreshes the browser, the app will do an internal query and retrieve the cached data. However, it will check the freshness of the data first to determine if it is still valid. If the data has been fetched before and has not expired, the query will acquire the data from the cache without fetching from the server. If the data has expired, however, the app will query the server to get fresh data.

By default, data is considered valid if it is residing in the cache memory for not more than 120,000 ms (two minutes).

You can change the storage duration limit by providing the lifeSpan parameter to runQuery . The sample code below sets the data validity to five minutes.

Last updated