I have had to solve the following problem enough in the last month that
I’m sure it has a name and a body of research behind it but I’m having
trouble finding it.
The general problem is this:
I have a Site Model. Each Site has many Consumers and Producers.
Producers make some amount of a “resource” available at the Site, while
Consumers use these “resources.” The program’s goal is to manage
changes in Consumers and Producers to keep them in balance.
When is it better to try to maintain a “resources” column in Site,
and when is it better to reproduce the data every time. In other words
is there a good way of “cashing” the resource calculation?
When a controller makes a change to a Consumer or Producer should the
model or the controller be responsible for asking the changed items Site
to rebalance its resources?
Is there a common name for this kind of problem that I can
google/wikipedia for more information?