refactor caching logic into statically defined class