For my site, I have models Category and Product, with hundreds of categories, each having thousands of products. For the Category views, I'd like to do something like average price of all the products included. And for the product views, I'd like the average for that product's category to appear.
So, with thousands of these calculations having to be stored somewhere, where's the best place to do it? Creating a lookup table with values? Or does caching/memoizing a Category action that calculates the average work fine?