Coding With Fun
Home Docker Django Node.js Articles Python pip guide FAQ Policy

Which is better advanced caching or streamlit caching?


Asked by London Waller on Nov 30, 2021 FAQ



Advanced Streamlit Caching. Caching = Better User Experience | by Rahul Agarwal | Towards Data Science It is straightforward now how to create a web app using Streamlit, but there are a lot of things that it doesn’t allow you to do yet.
Indeed,
Fortunately, Streamlit has an amazing option allowing you to cache the data and only run it if it has not been run before. The code above shows that you can cache any function that you create.
In this manner, Considerations for using caching 1 Decide when to cache data. Caching can dramatically improve performance, scalability, and availability. ... 2 Determine how to cache data effectively. ... 3 Cache highly dynamic data. ... 4 Manage data expiration in a cache. ... 5 Invalidate data in a client-side cache. ...
Next,
It can be tempting to throw that handy @st.cache decorator on everything and hope for the best. However, mindlessly applying caching means that we're missing a great opportunity to get meta and use streamlit to understand where caching helps the most.
Accordingly,
Based on the application needs, the caching layers would include a session cache for storing a user’s session data, a Content Delivery Network for serving static content, and a database cache for frequently accessed data such as the customer’s 10 most recent purchases.