Key-value store (kvstore)
Saves and reads small values such as progress on the server. Values are scoped to me and this material, and the server decides whose value it is from the token.
No personal information
Do not store learners' personal information (name · contact details · student id, etc.) in keys or values. Values are kept on the server and can be seen by educators, operators, and tutors. Since the server decides whose value it is from the token, there is no need to put a name or id in the value.
await sdk.kvstore.post({ key: 'userProgress', value: { step: 3, completed: false } });
const step = await sdk.kvstore.get<number>({ key: 'userProgress.step' }); // 3
await sdk.kvstore.delete('userProgress');
// 저장한 값 전체: 맨 위 key별 { key: value }
const all = await sdk.kvstore.get({ key: '' }); // { userProgress: { … }, … }
Key rules
- A key is a path of names made of letters · digits ·
_· Hangul (가–힣) joined by.(up to 256 characters). Example:userProgress.step post·deletedo not accept an empty key.get({ key: '' })returns all top-level keys as{ key: value }.- An invalid format results in
invalid_parambefore asking the server.
Behavior
- A missing value is
null, anddeleteof a missing key is not an error. postcreates missing objects in the middle of the path. If a value in the middle of the path is not an object, it fails withinvalid_input.- Values are stored as JSON, and names inside keys and values (
userProgress,snake_key, etc.) are sent and received as is, without conversion. - A tutor reads the values of the student they are viewing. A tutor's save · delete results in
read_only_mode.
Limits
| Limit | When exceeded |
|---|---|
| 512KB total for my values in this material | storage_limit_exceeded |
| 20 saves · deletes per second | rate_limited |