Hi,
I’m trying to find a design that allows me to make a single DB query for a list of widgets - to increase performance. These widgets might be changing rapidly so I don’t want to use caching. The main goal is to delegate DB queries to a marshal object. The issue is delaying the marshal/DB queries until all widget instances have been loaded, so I know which IDs to query.
Originally, each widget was calling 3 queries to find counts of Votes - upVoteCount, downVoteCount, and totalVoteCount. 5 voting stations/page @ 3 queries each = 15 DB queries!
I’ve refactored it to make a single DB call per widget and calculate the vote counts server side. 5 voting stations/page @ 1 query = 5 DB queries. I still think that’s too high.
2931
My first idea is to
[list=1][]disable the widget instances as they’re called[]add them to a list from their init method[]perform a single query based on their properties[]create and populate an object (Information Marshal?) with values[*]re-enable and run the widgets - they can then access the retrieved data[/list]
Can anybody shed some light on how to disable/enable the widgets or a similar technique?
Thanks,
Matt