Rewrite the cache logic to avoid ever caching empty results.