Add query caching.