@vercel/kv2 0.0.8 → 0.0.9
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/SKILL.md +15 -0
- package/package.json +1 -1
package/SKILL.md
CHANGED
|
@@ -8,6 +8,21 @@ Read the README for a quick overview and code examples:
|
|
|
8
8
|
node_modules/@vercel/kv2/README.md
|
|
9
9
|
```
|
|
10
10
|
|
|
11
|
+
## Usage pattern
|
|
12
|
+
|
|
13
|
+
Always use typed stores via `kv.getStore<V>(prefix)` rather than calling `kv.get`/`kv.set` directly. Typed stores enforce value types, scope keys by prefix, and support secondary indexes. Raw KV access should only be used for advanced scenarios like cross-store operations or dynamic key patterns.
|
|
14
|
+
|
|
15
|
+
```typescript
|
|
16
|
+
const kv = createKV({ prefix: "myapp/" });
|
|
17
|
+
|
|
18
|
+
// Good: typed store with enforced value type
|
|
19
|
+
const users = kv.getStore<User>("users/");
|
|
20
|
+
await users.set("alice", { name: "Alice", email: "alice@example.com" });
|
|
21
|
+
|
|
22
|
+
// Avoid: raw access loses type safety and prefix scoping
|
|
23
|
+
await kv.set("users/alice", someValue);
|
|
24
|
+
```
|
|
25
|
+
|
|
11
26
|
## Docs
|
|
12
27
|
|
|
13
28
|
Detailed documentation is available in the package's `docs/` directory. Read files as needed from `node_modules/@vercel/kv2/docs/`:
|