Skip to content

Cache

Under the cache config option Lighthouse can be configured to use an external cache system. Currently, only Redis is supported (in additional to in-memory caching).

redis_addr

string optional

The redis_addr option sets the address of a Redis server to be used as a cache backend. If set, Lighthouse initializes Redis caching at startup. If not set or empty, no external cache is used and in-memory defaults apply.

Typical formats:

  • hostname:port (e.g. localhost:6379)
  • ip:port (e.g. 10.0.0.5:6379)
config.yaml
cache:
  redis_addr: "localhost:6379"

username

string optional

Sets the Redis ACL username used to authenticate to the server. Leave empty when Redis is configured without ACL users.

config.yaml
cache:
  redis_addr: "localhost:6379"
  username: "app-user"

password

string optional

Sets the password for Redis authentication. Used with or without username depending on your Redis setup.

config.yaml
cache:
  redis_addr: "localhost:6379"
  password: "s3cr3t-pass"

redis_db

integer optional

Selects the Redis logical database index to use. Defaults to 0 if not set. Common deployments use 0; choose another index when sharing a Redis instance with other applications.

config.yaml
cache:
  redis_addr: "localhost:6379"
  redis_db: 1

disabled

boolean optional

Disables caching entirely when set to true. Lighthouse uses a no-op cache and does not persist or reuse responses.

Warning

This has serious performance implications. Only disable caching for testing / debuging!

config.yaml
cache:
  disabled: true

max_lifetime

duration optional

Sets the maximum lifetime for cached entries. When configured, this upper bound controls how long items may remain in the cache before they are considered expired and refreshed. If unset or 0, no upper limit is used.

config.yaml
cache:
  max_lifetime: "6h"