Skip to content

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

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

Feature request: an API to list only the keys in storage, not their values? #1699

Closed
nvie opened this issue Feb 20, 2024 · 0 comments
Closed

Comments

@nvie
Copy link

nvie commented Feb 20, 2024

Sometimes it would be useful to only list the "keys" using the Transactional Storage API, and not also having to retreive all of their values. If there are many entries, and they all have a lot of data in their values, then doing a .list() can potentially read N * 128 KiB of unneeded data into memory, which would only be discarded.

For example:

await state.storage.list({ prefix, startAfter, limit, /* etc etc */ });
// new Map([['foo', 'value1'], ['bar', 'value2']])

await state.storage.keys({ prefix, startAfter, limit, /* etc etc */ });
// ['foo', 'bar']
@cloudflare cloudflare locked and limited conversation to collaborators Feb 21, 2024
@kentonv kentonv converted this issue into discussion #1705 Feb 21, 2024

This issue was moved to a discussion.

You can continue the conversation there. Go to discussion →

Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant