properly clear the query cache