Fixes #5106: Refactored query caching to not load cache component when query caching is not used at all.