Synchronization problem while data insertion and displaying


I’m working on a project that imports data from csv files into the database, and displays it in tables and graphs. The problem I’m having is that when I import the data I can’t view it until I unplug my app from terminal and run the app again. So how can i optimize my app to make this process of importing and displaying in the same time or just by refreshing the page after importing the data?

Note: The application code is separated from one page to another as it appears in the following screen. I import the data from the “Home” page and display it on the “Production” page


This happens because the return value of get_data() is cached. Possible fixes:

  • Clear the cache when the data changes. If this is not possible with @cached functions, try @experimental_memo or @experimental_singleton.

  • Do not cache get_data(), call it only when the data changes and store the return value in session_state so that the other pages can access it.

1 Like

Thanks Mr Goyo, it works.