Configuring the Cache

In order to avoid querying the database on each page load, White Label Data will default to caching queries for 24 hours in memory. If a query changes, because filters or user-attributes change, a new query will be made to the database. You can configure the number of hours that queries should be cached for in appconfig.json on a per-page basis:

"app_pages": [
    {
        "page_type": "html",
        "nav_category" : "Sightings",
        "page_name": "overview",
        "page_title": "Overview",
        "page_src" : "overview.html",
        "cache_hours" : 1
    }
]

In the above example, the Sightings page will cache all queries for one hour.

Setting cache_hours to 0 means that data will never be cached and new queries will be made on each page load.

Viewing the Cache Timestamp and Reloading

If you wish to provide users with the ability to refresh the cache manually. You can add the following tag to your HTML page:

<wld_cache/>

This creates the following UI widget on your page in the top right corner (can be changed in your CSS file):