Skip to content

feat(durable): add get options (allowConcurrency, noCache) to Storage - #1101

Open
PedroRosalba wants to merge 1 commit into
cloudflare:mainfrom
PedroRosalba:feat/do-storage-get-options
Open

PedroRosalba wants to merge 1 commit into
cloudflare:mainfrom
PedroRosalba:feat/do-storage-get-options

Conversation

@PedroRosalba

Copy link
Copy Markdown

Problem

DurableObjectStorage.get(key, options) and get(keys, options) take a DurableObjectGetOptions object (allowConcurrency, noCache) that the crate has no way to pass (#716).

Change

Add Storage::get_with_options and Storage::get_multiple_with_options taking a new GetOptions struct, next to the existing get_alarm_with_options / set_alarm_with_options pattern. get and get_multiple are unchanged; get and get_with_options share one decode path. Additive API, minor changeset.

Tests

Puts two keys, reads them back through both new methods (options set and GetOptions::default()), and asserts that the options object the runtime receives is camelCase.

Tested on macOS (Apple Silicon) only.

Closes #716

`DurableObjectStorage.get(key, options)` and `get(keys, options)` take a
`DurableObjectGetOptions` object (`allowConcurrency`, `noCache`) that the
crate had no way to pass (cloudflare#716). Add `Storage::get_with_options` and
`Storage::get_multiple_with_options` taking a new `GetOptions` struct, next
to the existing `get_alarm_with_options` / `set_alarm_with_options` pattern.
`get` and `get_multiple` are unchanged; `get` and `get_with_options` share
one decode path.

The test puts two keys, reads them back through both new methods (options
set and `GetOptions::default()`), and asserts that the options object the
runtime receives is camelCase.
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.

[Feature] Support allowConcurrency and noCache options for Durable Object get() function

1 participant