Add support for caching empty queries.