payloadcms-cloudflare-kv-plugin 1.0.0 → 1.0.1
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/README.md +26 -1
- package/package.json +1 -1
package/README.md
CHANGED
|
@@ -44,7 +44,9 @@ First, create a KV namespace in your Cloudflare dashboard or using Wrangler:
|
|
|
44
44
|
wrangler kv:namespace create "CACHE"
|
|
45
45
|
```
|
|
46
46
|
|
|
47
|
-
This will output a namespace ID. Add it to your `wrangler.toml`:
|
|
47
|
+
This will output a namespace ID. Add it to your `wrangler.toml` or `wrangler.jsonc`:
|
|
48
|
+
|
|
49
|
+
**Using `wrangler.toml`:**
|
|
48
50
|
|
|
49
51
|
```toml
|
|
50
52
|
[[kv_namespaces]]
|
|
@@ -52,6 +54,19 @@ binding = "CACHE"
|
|
|
52
54
|
id = "your-namespace-id"
|
|
53
55
|
```
|
|
54
56
|
|
|
57
|
+
**Using `wrangler.jsonc`:**
|
|
58
|
+
|
|
59
|
+
```jsonc
|
|
60
|
+
{
|
|
61
|
+
"kv_namespaces": [
|
|
62
|
+
{
|
|
63
|
+
"binding": "CACHE",
|
|
64
|
+
"id": "your-namespace-id"
|
|
65
|
+
}
|
|
66
|
+
]
|
|
67
|
+
}
|
|
68
|
+
```
|
|
69
|
+
|
|
55
70
|
Then configure the plugin in your Payload config:
|
|
56
71
|
|
|
57
72
|
```typescript
|
|
@@ -436,6 +451,16 @@ cloudflareKVCache({
|
|
|
436
451
|
binding = "CACHE"
|
|
437
452
|
id = "your-namespace-id"
|
|
438
453
|
|
|
454
|
+
// Or in wrangler.jsonc:
|
|
455
|
+
{
|
|
456
|
+
"kv_namespaces": [
|
|
457
|
+
{
|
|
458
|
+
"binding": "CACHE",
|
|
459
|
+
"id": "your-namespace-id"
|
|
460
|
+
}
|
|
461
|
+
]
|
|
462
|
+
}
|
|
463
|
+
|
|
439
464
|
// In your code:
|
|
440
465
|
cloudflareKVCache({
|
|
441
466
|
kv: env.CACHE, // Make sure this matches the binding name
|