@clov-std/elysia-cache 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 +6 -5
- package/package.json +9 -9
package/README.md
CHANGED
|
@@ -112,7 +112,8 @@ new Elysia()
|
|
|
112
112
|
{
|
|
113
113
|
isCached: {
|
|
114
114
|
ttl: 60,
|
|
115
|
-
keyGenerator: (request, body) =>
|
|
115
|
+
keyGenerator: (request, body) =>
|
|
116
|
+
generateCacheKey(request, body, ['accept-language'])
|
|
116
117
|
}
|
|
117
118
|
},
|
|
118
119
|
() => listItems()
|
|
@@ -140,10 +141,10 @@ Builds the key for a request: `method:url`, the `vary` header values, then the p
|
|
|
140
141
|
|
|
141
142
|
### `CacheOptions`
|
|
142
143
|
|
|
143
|
-
| Option | Type
|
|
144
|
-
| -------------- |
|
|
145
|
-
| `ttl` | `number`
|
|
146
|
-
| `vary` | `string[]`
|
|
144
|
+
| Option | Type | Default | Description |
|
|
145
|
+
| -------------- | ------------------------------------------------------------------------------------------ | --------------------------------------- | -------------------------------------------------------------------------- |
|
|
146
|
+
| `ttl` | `number` | - | Time to live, in seconds. |
|
|
147
|
+
| `vary` | `string[]` | `['authorization']` | Header names included in the key. |
|
|
147
148
|
| `keyGenerator` | `(request: Request, body: unknown) => string \| undefined \| Promise<string \| undefined>` | `generateCacheKey(request, body, vary)` | Custom key builder. Returning `undefined` opts the request out of caching. |
|
|
148
149
|
|
|
149
150
|
Full docs: [https://clovlabs.github.io/std/](https://clovlabs.github.io/std/)
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@clov-std/elysia-cache",
|
|
3
|
-
"version": "1.0.
|
|
3
|
+
"version": "1.0.1",
|
|
4
4
|
"description": "Cache plugin for Elysia framework.",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"bun",
|
|
@@ -17,7 +17,7 @@
|
|
|
17
17
|
"repository": {
|
|
18
18
|
"type": "git",
|
|
19
19
|
"url": "git+https://github.com/ClovLabs/std.git",
|
|
20
|
-
"directory": "packages/elysia-
|
|
20
|
+
"directory": "packages/elysia-cache"
|
|
21
21
|
},
|
|
22
22
|
"files": [
|
|
23
23
|
"dist"
|
|
@@ -40,17 +40,17 @@
|
|
|
40
40
|
"test": "bun test --pass-with-no-tests --coverage"
|
|
41
41
|
},
|
|
42
42
|
"dependencies": {
|
|
43
|
-
"@clov-std/kv-store": "
|
|
43
|
+
"@clov-std/kv-store": "^2.0.1"
|
|
44
44
|
},
|
|
45
45
|
"devDependencies": {
|
|
46
|
-
"@types/bun": "
|
|
47
|
-
"oxfmt": "
|
|
48
|
-
"oxlint": "
|
|
49
|
-
"oxlint-tsgolint": "
|
|
50
|
-
"typescript": "
|
|
46
|
+
"@types/bun": "^1.3.14",
|
|
47
|
+
"oxfmt": "0.66.0",
|
|
48
|
+
"oxlint": "1.81.0",
|
|
49
|
+
"oxlint-tsgolint": "7.0.2001",
|
|
50
|
+
"typescript": "^7.0.2"
|
|
51
51
|
},
|
|
52
52
|
"peerDependencies": {
|
|
53
|
-
"@clov-std/kv-store": "
|
|
53
|
+
"@clov-std/kv-store": "^2.0.1",
|
|
54
54
|
"elysia": "next",
|
|
55
55
|
"typebox": "^1.3.11"
|
|
56
56
|
}
|