Ensure query cache is not ArrayCache in production

This PR applies the same check for the query cache that was done for the metadata cache in #1177 (as suggested by @stof).