refactor caches to be internal