Reconfigure caching.

Use permanent, long and short duration caching. Adapt unit tests.