You don’t need to buffer the whole thing
You don’t need to buffer the whole thing in memory, you can stream directly from R2 into the Cache
7 Replies
Hmm, that's interesting. I didn't realize you could stream to the cache
Yep, the Cache API takes a
Request
to match against, and a Response
to returnSo do you think I'd manually cache the entire audio, and then on successive calls pull from cache, zoom to the right bits and deliver those?
Yeah. If you don't mind slightly higher pricing, you could issue two concurrent requests against R2, one for the entire file(which is then put to the cache asynchronously), and then another one for just the requested range
This is good stuff. Thanks, will poke around
@Hello, I’m Allie! if I store the full audio in the cache, there's no way to issue a range request against the cache is there?
I'll need to pull the whole thing and slice the bits myself?

I really cannot for the life of me get the cache to response properly to a range request. It's always just returning the whole cached file.