Purging with response
When Fastly sends request to a backend it can respond w/ ‘Surrogate-Keys’ header to set up caching associations. Is it possible to remove those associations with the same response?
E.g. backend provides ‘Purged-Surrogate-Keys’ while responding with the list of keys to purge (e.g. keys which were affected during the request) so there is no need to hit Fastly API in background w/ every single key from this list. This should both increase cache invalidation speed and reduce traffic between Fastly and a backend.
Another option can be bulk purge API which accepts multiple surrogate keys at once.
The short answer is no.
The cached objects would retain their Surrogate-Key associations until they refreshed with objects that didn't have them.
i.e. once an object is cached, there's no changing the headers until that object refreshes/purges.
There currently isn't a way to purge multiple SKs at the same time, but you can have multiple keys on objects as well (there's 16k of keyspace available with a 1k limit for any individual key). This provides users the flexibility to create surrogate keys that capture different types of associations.
Hope this helps.
Surrogate-Keyheader for the sake of the current discussion. This is actually a feature request for a hypothetical
Purge-Surrogate-Keysheader, which would instruct Fastly to purge the listed keys, thus saving a number of round-trips between the customer application and the API.
Please sign in to leave a comment.