Temp cache changes

@apazzolini saw some queries showing up during load testing, so I made some alterations for caching. Please review to make sure this does not interfere with any expected behavior in advanced cms.