You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
the intent was to cache data from subgraphs only if a Cache-Control header was returned, but there is currently a bug, where all of the data is cached even when the header is not present, and if the TTL is not configured, the data will not expire.
There is also confusion on what should be done if the TTL is configured. So, to nail down how caching should behave:
if not configured on any subgraphs, do not cache anything
enabled option, boolean, activates caching, defaults to false. It can be overridden per subgraph, so if it is set to true and a subgraph sets it to false, then all subgraph will be cached except for that specific subgraph. At this point caching is still opt-in on the part of the subgraph, it has to provide a Cache-Control header
ttl option, duration. A global TTL can be configured under the redis option. It can also be overridden per subgraph. If a subgraph returns a Cache-Control header without a TTL, then we will get that TTL from configuration. If the header specifies a max-age, then we will use that for expiration
add an option always_cache, to cache responses even when the subgraph does not provide a Cache-Control header
We also need a reasonable default TTL for caching, to make sure we can't have data stored indefinitely
In the future, once the router has more ability to recognize which parts of the schema should be cached:
if enabled, globally or per subgraph:
if the subgraph does not provide a Cache-Control header, rely on the indications from the schema
if the subgraph provides a Cache-Control header, follow what the header says
The text was updated successfully, but these errors were encountered:
Fix#4880
The entity cache plugin intended to require a `Cache-Control` header
from the subgraph to decide whether or not a response should be cached.
Unfortunately in the way tit was set up, all responses were stored.
The plugin now makes sure that the `Cache-Control` is there, and if a
subgraph does not provide it, then the aggregated `Cache-Control` header
sent to the client will contain `no-store`.
Additionally, the Router will now check that a TTL is configured for all
subgraphs, either in per subgraph configuration, or globally.
the intent was to cache data from subgraphs only if a
Cache-Control
header was returned, but there is currently a bug, where all of the data is cached even when the header is not present, and if the TTL is not configured, the data will not expire.There is also confusion on what should be done if the TTL is configured. So, to nail down how caching should behave:
enabled
option, boolean, activates caching, defaults to false. It can be overridden per subgraph, so if it is set to true and a subgraph sets it to false, then all subgraph will be cached except for that specific subgraph. At this point caching is still opt-in on the part of the subgraph, it has to provide aCache-Control
headerttl
option, duration. A global TTL can be configured under theredis
option. It can also be overridden per subgraph. If a subgraph returns aCache-Control
header without a TTL, then we will get that TTL from configuration. If the header specifies amax-age
, then we will use that for expirationalways_cache
, to cache responses even when the subgraph does not provide aCache-Control
headerWe also need a reasonable default TTL for caching, to make sure we can't have data stored indefinitely
In the future, once the router has more ability to recognize which parts of the schema should be cached:
enabled
, globally or per subgraph:Cache-Control
header, rely on the indications from the schemaCache-Control
header, follow what the header saysThe text was updated successfully, but these errors were encountered: