Set hooks for caching.