How to reuse database query between blocks?

Permalink
Hi.

I have two blocks on the page and both are requesting the same stuff from the DB. How can I reduce the DB calls to one query and use the data in both blocks?

Regards,
Mark

malthoff
 
JohntheFish replied on at Permalink Reply
JohntheFish
You would ideally put the query into a separate model class and load that model into both block controllers.
malthoff replied on at Permalink Reply
malthoff
How would that prevent the DB query to be called twice? Both would instantiate the model what causes the query to be made. Or is a model object only instantiated once per page load?