Skip to content

Conversation

cceckman-at-fastly
Copy link
Contributor

@cceckman-at-fastly cceckman-at-fastly commented Jun 12, 2025

The core cache API allows for cache items to be concurrently streamed to / from the cache.

Previously, if:

  • The size of the cached item's body was not provided by the writer
  • The reader requests a specific range of the cached item's body
  • The writer and reader are concurrent, i.e. the body is streamed from one to the other

then the core cache API will ignore the requested range and provide the whole body. There is no explicit notification that the whole body is provided instead of a range.

In this SDK release we change the default: body reads through the cache will use the requested range even when streaming. A lookup option allows setting the legacy behavior.

@cceckman-at-fastly cceckman-at-fastly marked this pull request as ready for review June 12, 2025 20:50
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Requesting a change for at least the comment formatting, but also to open a discussion about the API in general.

Copy link
Collaborator

@cee-dub cee-dub left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

A couple of minor things that should be addressed before merge.

@dgryski
Copy link
Member

dgryski commented Jun 23, 2025

Failing CI

@cceckman-at-fastly cceckman-at-fastly force-pushed the cceckman/requested-range branch from 92e5c23 to 6071bea Compare August 1, 2025 14:56
cceckman-at-fastly and others added 7 commits August 12, 2025 15:57
The core cache API allows for cache items to be concurrently streamed to / from the cache.

If:
- The size of the cached item's body was not provided by the writer
- The reader requests a specific range of the cached item's body (`to_stream_from_range`)
- The writer and reader are concurrent, i.e. the body is streamed from one to the other

then today, the core cache API will ignore the requested range and provide the whole body. There is no explicit notification that the whole body is provided instead of a range.

In this SDK release, this remains the default behavior. However, the lookup options struct now now offers an `AlwaysUseRequestedRange` option. If set to true, body reads conducted as part of this lookup/transaction will always use the requested range, even when streaming. If false, the behavior is unchanged (as above).

In a future SDK release, the default behavior will change to
"always use requested range".
Co-authored-by: Cameron Walters (cee-dub) <[email protected]>
Co-authored-by: Cameron Walters (cee-dub) <[email protected]>
Copy link
Member

@dgryski dgryski left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

LGTM. Can you either squash these commits on the PR or have github do it when you merge?

@cceckman-at-fastly cceckman-at-fastly merged commit 9905e46 into main Aug 14, 2025
12 of 17 checks passed
@cceckman-at-fastly cceckman-at-fastly deleted the cceckman/requested-range branch August 14, 2025 15:09
@cceckman-at-fastly
Copy link
Contributor Author

Done as a squash on the PR, with an updated message reflecting the behavior.

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

Successfully merging this pull request may close these issues.

3 participants