Skip to content

Cache Overview

Caching is a performance optimization technique that stores the results of previously executed queries so they can be reused without re-running the same query on the underlying data source.

  • Purpose of caching query results: Reduce repetitive query execution costs, improve responsiveness, and handle high user concurrency more efficiently.

  • Benefits:

    • Performance: Queries load significantly faster since they avoid complex database scans.
    • Reduced load: Backend systems and databases are protected from unnecessary repeated requests.
    • User experience: Dashboards and reports open quickly, supporting interactive analysis at scale.

When a query is executed in Grafieks, the following flow is used:

  1. Query submission: The user triggers a query (e.g., opening a dashboard or running a report).

  2. Cache check: The platform first checks if the result of this query already exists in the cache.

    • If cache hit → The result is returned immediately from cache.
    • If cache miss → The query runs on the data source.

  3. Storing results: If a miss occurs, once the query finishes, its result is stored in the cache for future reuse.

  4. Cache scope: Frequently used queries tied to a specific report are cached centrally.

  5. Dashboard-level invalidation:

    • Cache invalidation is typically configured at the dashboard level.
    • However, if the same report is used across multiple dashboards, and one dashboard has a different cache invalidation setting (for example, a shorter refresh interval), that setting will apply to the report universally.

⚠️ Important: In the current version, if a report is reused across multiple dashboards, the shortest cache duration or strictest invalidation policy configured in any one dashboard will override others. This ensures consistency but may lead to more frequent refreshes than expected.

This mechanism reduces redundant execution while ensuring consistent cache behavior across dashboards that reuse the same reports.