Refactor stuff in util and persistence only used in cache module to cache module.