Revert "Revert "added caching.""

This reverts commit 4a4328668c152f4014123809fe0a0b48bbe04c44.
Changed caching strategy.