Caching in the Apollo Router
The Apollo Router comes with an in-memory cache, used to store Automated Persisted Queries (APQ) and query plans. This is a Least Recently Used (LRU) cache, that can be configured as follows:
router.yaml
supergraph:apq:experimental_cache:in_memory:limit: 512query_planning:experimental_cache:in_memory:limit: 512
Introspection responses are cached too, but that cache is not configurable for now.
Experimental Redis cache
The Apollo Router has an experimental external storage cache, using Redis Cluster or a single Redis instance (if you provide only one url).
It can be tested by building a custom Router binary, with the Cargo feature experimental_cache
.
This will activate a configuration option to connect to a Redis Cluster:
supergraph:apq:experimental_cache:in_memory:limit: 512redis:urls: ["redis://..."]query_planning:experimental_cache:in_memory:limit: 512redis:urls: ["redis://..."]