Refreshing cache manually

Please consider this code. It reloads getdata() when I enter a certain date.

def getdata():
    # download tons of data from Dutch government site
   df = /thedatadownloaded in a dataframe/
   global UPDATETIME
   return df, UPDATETIME 
def main(): 
     df_getdata, UPDATETIME = get_data()
     df = df_getdata.copy(deep=False) 
     until_ = st.sidebar.text_input('enddate (yyyy-mm-dd)',today)
         UNTIL = dt.datetime.strptime(until_,'%Y-%m-%d').date()
         st.error("Please make sure that the enddate is in format yyyy-mm-dd")

     if until_ == "2023-08-23":
        st.sidebar.write("Clear cache")
        until_ = "2021-01-01"
        st.sidebar.write("To start change a setting!\nChange the date afterwards!")

Consider the code above. It is made to manually empty the cache. If I enter the magic date and change an option, the reloading begings. But if I change the date after, it empties the cache and reloads the data again.

My questions:

  1. Why do I have to change an option? I would expect that the clearing of the cache starts at the moment that I enter the magic date and hit the button enter
  2. Why does it clear the cache again if I set the date back to the current date?

Complete code can be found here COVIDcases/ at main · rcsmit/COVIDcases · GitHub

The app is here

Thanks in advance

I know already the answer on 1. It clears the cache, but it only reloads my data after changing a parameter.