Optimise across panels

Is it possible to optimise across panels in terms of data retrieval?

If you have the same configuration to pull from a custom datasource plugin on 2 different panels for the same time range etc then it would still cause two data calls to the data source.

Is there a way within Grafana to use a data cache, or equivalent, to optimise across panels?

For now I have a bit of a hack to use some session storage and have the panels check which panel “owns” the query, i.e. which panel on the dashboard first made the call. Other panels then read from the client side cache. That works.

I want it to be a bit more clever though, especially on dashboard load or time range change. I know the Panel Ids for each of the panels where the same query is being used. I would like to trigger those panels to re-evaluate the query once the owner panel has got the data back and cached it.
Is there a way to trigger a “refresh” or query on a specific panel from code?

In case anyone is interested, or if there is a better way, I am just triggering a dashboard refresh for now using:

Add the $rootScope into the datasource constructor…then…

this.rootScope.$broadcast(‘refresh’);

I’ll have a poke around for refreshing individual panels, unless someone knows that can’t be done to save me some time.

you need to implement your own cache in your data source

Is it possible to call refresh on a panel from another panel?

I can broadcast a general refresh, but I only want to refresh the data on certain panels.

OR

How do I re-trigger the query(options) method call on a datasource without a general refresh of all panels?