Caching

Spotrix uses Flask-Caching for caching purposes. Flask-Caching supports various caching backends, including Redis (recommended), Memcached, SimpleCache (in-memory), or the local filesystem. Custom cache backends are also supported.

Caching can be configured by providing a dictionaries in spotrix_config.py that comply with the Flask-Caching config specifications.

The following cache configurations can be customized in this way:

  • Dashboard filter state: FILTER_STATE_CAHCE_CONFIG required

  • Explore chart from data: EXPLORE_FROM_DATA_CACHE_CONFIG required

  • Metadata cache: CACHE_CONFIG optional

  • Charting data required from datasets: DATA_CACHE_CONFIG optional

For example, to configure the filter state cache using redis:

FILTER_STATE_CACHE_CONFIG = {
    'CACHE_TYPE': 'RedisCache',
    'CACHE_DEFAULT_TIMEOUT': 86400,
    'CACHE_KEY_PREFIX': 'spotrix_filter_cache',
    'CACHE_REDIS_URL': 'redis://localhost:6379/0'
}

Last updated