Set caching when needed, and invalidate when time passes.