Purge batch of surrogate keys


#1

Hi FASTLY!

I want to purge 100 surrogate keys using the REST API.

Is there a way to do that with a single request, or should I make 100 requests?

Thanks


#2

Hi sky,

You can only purge one key per request, so you’d have to make 100 requests.

However, this suggests that perhaps you could have set a common surrogate key on all these objects? That would allow you to purge them with one request.

Regards, Léon


#3

THANK YOU LÉON!

Those 100 keys are chosen from a pool of 1000 keys based on custom logic, and are always different.

IT WOULD BE VERY USEFUL TO HAVE THE FUNCTIONALITY OF PURGING BATCH OF SURROGATE KEYS.
It would be both more easy to purge, and more FASTLY since it would go trough all cached objects once with all the batch.


#4

Thanks for the suggestion. That seems like a reasonable feature and I’ve passed it on to our development team.

Regards, Léon


#5

I guess it should also be noted that you can have multiple surrogate-keys per object, up to 16kB of keyspace for keys with a 1kB max size for a single key, so batches might not necessarily be needed if you wanted to do things like tag objects with oh…let’s say “css” , “/static” , “build1234” , “v-day” and/or “10Jan2016”, it might be easy to create logical groupings that minimize the need for multiple purges.

–Peter


#6

THANK YOU LÉON, YOU ARE DOING GOD’S WORK!

Peter thanks for the suggestion, however we cannot create logical groupings since the resources needed to be purged are dynamic.


#7

Echoing the need for this. Drupal 8 has built-in support for cache tags, which is effectively identical to Fastly’s cache tags. Drupal 8 very often needs to invalidate multiple cache tags (~ surrogate keys) at the same time.


#8

+1 waiting for this feature


#9

I just wanted to make sure that everyone had seen our blog: at this point, batch surrogate key purging is live.

https://www.fastly.com/blog/introducing-batch-api-surrogate-key-purge