Caching not working

Hi, I’m loving streamlit, just having issues with caching. My streamlit site is up, here https://share.streamlit.io/cyrusb01/streamlit-bt/dashboard.py, I just need some help with caching my data. In the beginning of my code I create a data variable which is what all my charts and functions use, and I would like to cache it to speed up my app. My code is in my github, and the file I use for the main app is dashboard.py GitHub - Cyrusb01/Streamlit-bt. I am trying to cache this function, but whenever i put @st.cache above it, the site will not deploy. I have been messing around with different variations of caching, and they never will deploy, but always work locally. If anyone could help me cache my data, or any tips on speeding up my site that would be great.


This is the error i get

Hi @Cyrusb01, welcome to the Streamlit community!

I forked the repo and launched from my account, including the st.cache statement and it seems to be working. So you don’t have a code issue as far as I can tell. Not sure what to suggest, maybe shutdown the app and re-launch it?

Best,
Randy

Hi Randy @randyzwitch, I really appreciate the response. So after I posted my first post about the caching not working, I actually was making some edits to the site, and pushed it all to Github before you tried. So what I have noticed is that I have three different pages on the site, ‘BTC Portfolio Dashboard’, ‘Flexible Dashboard’, and then the ‘Portfolio Optimizer’, each react differently when refrenced as the home page. After you tried doing the caching I wondered why yours worked and not mine, but the reason this happened is because I had changed loading page to the ‘Portfolio Optimizer’, which was initially the ‘Flexible Dashboard’. For some reason if I make the initial page the ‘Flexible Dashboard’, the site will crash before it loads(when i try and cache data). As well, I have noticed that if more than one person is using the site at the same time it will crash as well. Do you have any tips on improving speed, making it so many people can use it at the same time, and the caching issue when the first page that loads in is the ‘Flexible Dashboard’. Thank you so much for your help already.