Problem with Caching within a multi-page app

Hey guys, I am currently working on a multi page app and ran into the following problem:
my app is querying several tables from a database. Currently the data is queried whenver someone loads a page. Since it is quite a lot of data it usually takes some time to load the website. Instead of having to load them whenever a user switches the page I olny want to query it once whenever a user visits the website the first time. Therefore, I wanted to add memoization via redis to the functions that are querying the data. This way the data wouldn‘t be updated everytime a user changes the page, but on top of that it would also allow for even better performance since it would only query the data within certain time intervals for all users that are visiting the site. However, when I define the cache and the functions I want to be memorized in my file and call them in another page the content of the page won‘t load and I get the following error:

KeyError: <flask_caching.Cache object at 0x7f7d70ac3d30>

Even after an extensive search I couldn’t find any solution to this. Maybe someone here has encountered the same issue or knows how to solve it. Thanks in advance.