Caching

Version: 3.5.0+

Starting with version 3.5.0, queries that take a bit longer have their results automatically cached for a short period of time.

Checking if data is cached

When retrieving data takes longer than scai.cache.query.min.exectime (by default 100ms), starting with version 3.5.0, Scai automatically caches (stores it in memory) it for a short period. Then, next time it is requested, Scai will display the stored version of the data.

To check if a cached version of the data was used to display the results within either a table or a graph, move the mouse over the button, without clicking it. If no such button is visible (after unlocking the dashboard if needed), then the table/graph contains the latest version of the data. If there is such a button and you hover on it for a second, you will see the timestamp of the point in time the data was last retrieved from the data source. You will also see when it will be next refreshed.

Example:Last refreshed: Mon Jul 22 12:46:13 GMT 2018. Next refresh: Mon Jul 22 13:16:13 GMT 2018

Refreshing tabular data

To refresh (get the latest data from the data source) tabular data, simply click on the button from the header of the table widget. If no such button can be found, then the data has not been cached and what you see is probably the latest version of the data as it is stored in the data source.

Refreshing graph data

To refresh (get the latest data from the data source) graph data:

  • click on the button in the dashboard menu to refresh data for all the widgets in a dashboard
  • alternatively, to manually pick which widgets you would like to have their data refreshed, unlock () the dashboard and then click the button for the widgets you desire.

How caching works

If retrieving data from the data source for a given table/graph takes longer than scai.cache.query.min.exectime (by default 100ms), Scai will store its results in memory such that next time it is requested it can return it to the user without querying the data source again.

Scai will use at most scai.cache.query.maxsize (by default 128M) memory for storing such data. After a period of time , Scai will evict (remove) the results from its memory and will query the data source the next time the data is cached. The period of time that the query results are cached by Scai are determined as the maximum of the following:

Parameters to fine tune query result caching

Take a look at scai.cache.query.ttl, scai.cache.query.maxsize, scai.cache.query.min.exectime and scai.cache.query.ttl.multiplier.