Caching Dashboards With Scheduler

(Joseph) #1

How does caching work with dashboards. I believe if it is still cached and a scheduled dashboard email is sent out, it will use the cache? Is there a way to force it to clear the cache before send of a scheduled task?

I would like to have my cache set for longer periods so when users come it is cached, but the issue I believe is that also affects scheduled emails as well and I want the cache to clear whenever a scheduled job is sent so it has the most relevant data and also creates a new cache for incoming users.

(Joseph) #2

And is the logic for caching the same for both scheduled dashboards and looks?

(Dave Hunsinger) #3

Regarding your first post, having the ability to clear the cache from a scheduled email job is something the Looker Product team is working on, but until there’s a cache management solution within email scheduling there are a couple of things you can try.

One thing to consider is using a scripted cron job to make an API call to clear cache before the scheduled email is sent. Doing this will help ensure that the scheduled email runs fresh queries before sending instead of pulling from query cache.

Another thing to experiment with is using the persist_for parameter at either the explore or model level to extend the time queries are allowed to be fetched from cache. Doing this overrides the default cache time of one hour (as of Looker 4.2, from five minutes in previous versions). If you set a persist_for of 24 hours, for instance, queries will be pulled from cache for that period, except when a user selects ‘Clear Cache and Refresh’ when running an explore, look or dashboard which ‘resets’ the cache timer for another 24 hours. That is, setting a 24-hour persist_for won’t automatically hold cache for one day, it will hold queries in cache for 24 hours from the last time the cache was cleared. If users are clearing cache every five minutes, for instance, the cache will persist for five minutes regardless of the persist_for setting.

Persist_for, in combination with API calls to clear cache before sending the scheduled email may do what you need!

Regarding your second post, caching logic is the same for both Dashboards and Looks.

I hope that helps!



Is there any way to set the explore to clear cache and refresh at a certain time of day without using an API call?

For example I’d like to set the explore to update at 2 certain times of day then cache in between.



(Zachary Michel) #5

@twood the only way to do so currently is with the API. We’re currently discussing exposing more granular caching options in the model using LookML.

(Kesang) #6

@Zam any updates on this?

(vincent) #7

Hi @kcee,

Are you trying to bust the cache or set the cache for a schedule?


(Kesang) #8

Hey @vincent,

I’m trying to set the cache for a couple scheduled dashboards.



(vincent) #9

Hi @kcee,

Right now the best way to do this is to setup a persist_for on the explore or to schedule the dashboard an hour before it goes out since the default cache time is an hour(unless you changed it with a persist for). Let me know if you have any questions or concerns.


(Emily) #10

Is there any update on this for scheduling dashboards? Would prefer not make API calls

(Sara Guzman) #11

Hi @e-rex, As Vincent mentioned above, this is still the recommended workaround for Caching Dashboards With Scheduler.