I'm trying to create job alerts. So every user will select certain filter criteria on their account, which will then be used to perform a search api query returning the relevant new jobs.
To my inexperienced programmer brain this sounds like a lot of queries that will scale terribly.
So I'm trying to construct something which will organise the users into groups who have the same criteria thus avoiding repetition of queries.
(i.e. divide a set of entities into groups based on field values).
My question is, is there a function or commonly used set of procedures for doing this? (Perhaps a module which I could look to for the design?)
Or another option, would the performance change be minimal, because of things like memcache and APC which would cache the queries which repeated?
My current design
In order to do this, my current thinking revolves around creating a branching set of queries.
First divide users by field a options, then divide each sub option into field b options and so on.
Each time you'd check to see if you ended up with 0 or 1 users in which case you could stop the tree.
Because I already use SearchAPI and have indexes running for users and nodes I would use this to query. (I'm assuming it would be faster than pulling from the database).