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

# Caching

> Spree's cache lives in Postgres by default (Solid Cache) — nothing extra to run, with a one-line Redis/Valkey swap for high-traffic installs.

Caching improves performance by storing the results of expensive computations. Spree's headless API caches sparingly — small memoized values (geo data, settings, taxonomy lookups) and the API's rate-limit counters — so the default store needs no dedicated service.

## Solid Cache — the default

Production uses [Solid Cache](https://github.com/rails/solid_cache) — the built-in cache store: the cache lives in your PostgreSQL database alongside everything else. There is nothing to configure, provision, or monitor — it works out of the box in every deployment.

## Swapping to Redis or Valkey

For high-traffic installs that want an in-memory cache, the swap is one line in `config/environments/production.rb` plus the gem:

```ruby theme={"theme":"night-owl"}
# Gemfile
gem "redis"

# config/environments/production.rb
config.cache_store = :redis_cache_store, { url: ENV["REDIS_URL"] }
```

Works identically with Redis or Valkey (the Linux Foundation fork most hosting platforms now provision).

## Testing Locally

To enable caching in the development environment:

<CodeGroup>
  ```bash Spree CLI (Docker) theme={"theme":"night-owl"}
  spree rails dev:cache
  ```

  ```bash Without Spree CLI theme={"theme":"night-owl"}
  bin/rails dev:cache
  ```
</CodeGroup>

You will need to restart your web server after this.
