Middleware that returns cached results for queries when applicable.
If caching is enabled (enable-query-caching
is true
) cached results will be returned for Cards if possible.
There's a global default TTL defined by the setting query-caching-default-ttl
, but individual Cards can override
this value with custom TTLs with a value for :cache_ttl
.
For all other queries, caching is skipped.
Various caching backends are defined in metabase.query-processor.middleware.cache-backend
namespaces. The default
backend is db
, which uses the application database; this value can be changed by setting the env var
MB_QP_CACHE_BACKEND
.
Refer to metabase.query-processor.middleware.cache-backend.interface
for more details about how the cache
backends themselves.
Middleware that returns cached results for queries when applicable. If caching is enabled (`enable-query-caching` is `true`) cached results will be returned for Cards if possible. There's a global default TTL defined by the setting `query-caching-default-ttl`, but individual Cards can override this value with custom TTLs with a value for `:cache_ttl`. For all other queries, caching is skipped. Various caching backends are defined in `metabase.query-processor.middleware.cache-backend` namespaces. The default backend is `db`, which uses the application database; this value can be changed by setting the env var `MB_QP_CACHE_BACKEND`. Refer to `metabase.query-processor.middleware.cache-backend.interface` for more details about how the cache backends themselves.
Should we force the query to run, ignoring cached results even if they're available?
Setting this to true
will run the query again and will still save the updated results.
Should we force the query to run, ignoring cached results even if they're available? Setting this to `true` will run the query again and will still save the updated results.
(maybe-return-cached-results qp)
Middleware for caching results of a query if applicable. In order for a query to be eligible for caching:
enable-query-caching
Setting) must be enabled:cache-ttl
value. For Cards, this can be the value of :cache_ttl
,
otherwise falling back to the value of the query-caching-default-ttl
Setting./api/card/
endpoints that make use of caching do can-read?
checks for the Card before
running the query, satisfying this requirement.)query-caching-max-kb
when serialized (before compression).Middleware for caching results of a query if applicable. In order for a query to be eligible for caching: * Caching (the `enable-query-caching` Setting) must be enabled * The query must pass a `:cache-ttl` value. For Cards, this can be the value of `:cache_ttl`, otherwise falling back to the value of the `query-caching-default-ttl` Setting. * The query must already be permissions-checked. Since the cache bypasses the normal query processor pipeline, the ad-hoc permissions-checking middleware isn't applied for cached results. (The various `/api/card/` endpoints that make use of caching do `can-read?` checks for the Card *before* running the query, satisfying this requirement.) * The result *rows* of the query must be less than `query-caching-max-kb` when serialized (before compression).
cljdoc is a website building & hosting documentation for Clojure/Script libraries
× close