Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

How to control Cache in Compute@Edge? #52

Open
StarpTech opened this issue Nov 14, 2021 · 2 comments
Open

How to control Cache in Compute@Edge? #52

StarpTech opened this issue Nov 14, 2021 · 2 comments

Comments

@StarpTech
Copy link

StarpTech commented Nov 14, 2021

Hello, we currently experimenting with Compute@Edge. VCL provides a lot of features to control the cache. However, the Rust SDK provides only a few overrides like req.set_ttl(60). Is that all? Our use case is to transform POST to GET with the ability to configure the response cache.

At Cloudflare we are able to do that with the Cache API. That store can be configured with simple cache headers.

Primary use case: Cache the POST request on the edge without transforming the origin request to GET + configuring the cache for the stored request.

According to the documentation I found:

In a future release, it will be possible to interact with the cache and the network separately.

Is there any eta?

Therefore in VCL we can manipulate the req based on conditions of beresp. How is it done with the Rust SDK?

@cratelyn
Copy link
Contributor

Hello! Thank you for opening an issue about this.

Fine grained cache control API's for Compute@Edge is something that we are currently working on, with great urgency. While I cannot offer a public timeline for availability today, you would be welcome to our early process if you'd like to be involved in early testing!

There are some other cache overrides in the Rust SDK including stale_while_revalidate and surrogate_key settings; they might not be applicable to your use case, but they are other noteworthy axes of cache behavior that can be controlled today.

I hope this information helps, and look forward to future updates on this front. ❤️

@StarpTech
Copy link
Author

Hi, thanks for the response. We would be happy to test it. I hope in the long term the goal is to have the same flexibility on the Edge as with VCL. As a workaround, we use service chaining to gain from both approaches. I have some questions though:

compute@edge: My rust service
delivery_service: classic fastly CDN

I still do not understand the effect of the overrides when using service chaining. For example surrogate_key. Is it possible to chain them so we can purge them all at once on the compute@edge service? I tried but it didn't work. I also respected the order of the keys compute@edge->delivery_service

Besides that, the only solution to make surrogate keys work on the fastly delivery_service was to use req.set_pass(true) on the compute@edge service otherwise it seems that a default caching policy is used. Is that correct?

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants