Feature: Add Option for Arbitrary Prefix to Session ID in Cloudflare KV Storage #7650
intercept6
started this conversation in
Proposals
Replies: 0 comments
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Uh oh!
There was an error while loading. Please reload this page.
-
Description
The current implementation of session storage in Cloudflare KV generates a random session ID without the option to add an arbitrary prefix. This feature request aims to introduce an option to add a user-defined prefix to the session ID.
Motivation
Having the ability to add an arbitrary prefix to session IDs can be useful for:
Facilitates classification when storing non-session data within a single Cloudflare KV.
Implementing additional custom logic that may require a specific naming convention for session IDs.
Proposed Solution
Add a new option in the WorkersKVSessionStorageOptions interface to specify the prefix for session IDs. The session creation logic should then concatenate this prefix with the randomly generated session ID.
For example, the WorkersKVSessionStorageOptions interface could look something like:
And the session ID creation logic could be modified as:
Beta Was this translation helpful? Give feedback.
All reactions