Deleted categories are always listed until the page is refreshed again

I tried to use wp_delete_category () and wp_delete_term () delete a category, but after reloading the page, the deleted category still appears in the results of the get_categories (). But if I reload the page a second time, the category is gone.

How can I make sure it's okay after the first reload?