The way Streamlit keeps track of changes in these components is through hashing. Think of the cache as an in-memory key-value store, where the key is a hash of all of the above and the value is the actual output object passed by reference.
Finally, @st.cache supports arguments to configure the cache's behavior. You can find more information on those in our API reference.
Let's take a look at a few examples that illustrate how caching works in a Streamlit app.
Example 1: Basic usage
For starters, let's take a look at a sample app that has a function that performs an expensive, long-running computation. Without caching, this function is rerun each time the app is refreshed, leading to a poor user experience. Copy this code into a new app and try it out yourself:
```python
import streamlit as st
