Closed g105b closed 9 months ago
As said above, upload earnings will cache perfectly easily: a new field on the Upload table to record the earning once.
Products will need invalidating. This can be done by introducing a single new field on the Product table for cached earnings. When a new usage is processed that touches this product, we can set this cache to null, forcing it to be recalculated again.
Discussion:
An upload's total earnings can be cached, and that will never change (the way things are currently set up)
A product's total earnings can be cached. If a new upload contains 1 or more rows relating to that product, the cache is cleared and recached.
No need to cache the costs and splits as these will be few in number.
The outgoing and profit are just simple calculations.
Bug reported #152
Bug reported #154
Currently the earnings are calculated every page render, but when there are hundreds of thousands of usages, render times start getting quite slow.
The total earnings can easily be cached on the upload. Products probably need to have some sort of invalidation technique so they can update when there's more usages imported.