> ## Documentation Index
> Fetch the complete documentation index at: https://developers.stellar.org/llms.txt
> Use this file to discover all available pages before exploring further.

# Use temporary storage in a contract

> Temporary storage is useful for a contract to store data that can quickly become irrelevant or out-dated

Temporary storage is useful for a contract to store data that can quickly become irrelevant or out-dated. For example, here's how a contract might be used to store a recent price of BTC against the US Dollar.

```rust theme={"theme":{"light":"github-light","dark":"github-dark"}}
// This function updates the BTC price
pub fn update_btc_price(env: Env, price: i128) {
    env.storage().temporary().set(&!symbol_short("BTC"), &price);
}

// This function reads and returns the current BTC price (zero if the storage
// entry is archived)
pub fn get_btc_price(env: Env) -> i128 {
    if let Some(price) = env.storage().temporary().get(&!symbol_short("BTC")) {
        price
    } else {
        0
    }
}
```
