Currently, we clear query_cache in cache block finish, even if we may already have cache true.

This commit takes into account the last cache_enabled value, before clearing query_cache.