Refactor caching, add mongodb cache backend