Rails cache optimize

This uses the Rails caching mechanism to optimize database load on the application layer.
These optimizations were initially developed in #112 and rebased to the current staging branch.
I think we don't want to do this in prod