@spoosh/plugin-cache 0.1.1 → 0.1.3
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 +4 -3
- package/dist/index.d.mts +8 -2
- package/dist/index.d.ts +8 -2
- package/package.json +4 -4
package/README.md
CHANGED
|
@@ -13,11 +13,12 @@ npm install @spoosh/plugin-cache
|
|
|
13
13
|
## Usage
|
|
14
14
|
|
|
15
15
|
```typescript
|
|
16
|
+
import { Spoosh } from "@spoosh/core";
|
|
16
17
|
import { cachePlugin } from "@spoosh/plugin-cache";
|
|
17
18
|
|
|
18
|
-
const
|
|
19
|
-
cachePlugin({ staleTime: 5000 }),
|
|
20
|
-
]
|
|
19
|
+
const client = new Spoosh<ApiSchema, Error>("/api").use([
|
|
20
|
+
cachePlugin({ staleTime: 5000 }),
|
|
21
|
+
]);
|
|
21
22
|
|
|
22
23
|
// Per-query override
|
|
23
24
|
useRead((api) => api.posts.$get(), { staleTime: 10000 });
|
package/dist/index.d.mts
CHANGED
|
@@ -28,11 +28,17 @@ type CacheWriteResult = object;
|
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
|
-
*
|
|
31
|
+
* import { Spoosh } from "@spoosh/core";
|
|
32
|
+
*
|
|
33
|
+
* const client = new Spoosh<ApiSchema, Error>("/api")
|
|
34
|
+
* .use([
|
|
35
|
+
* // ... other plugins
|
|
36
|
+
* cachePlugin({ staleTime: 5000 }),
|
|
37
|
+
* ]);
|
|
32
38
|
*
|
|
33
39
|
* // Per-query override
|
|
34
40
|
* useRead((api) => api.posts.$get(), {
|
|
35
|
-
* staleTime: 10000,
|
|
41
|
+
* staleTime: 10000,
|
|
36
42
|
* });
|
|
37
43
|
* ```
|
|
38
44
|
*/
|
package/dist/index.d.ts
CHANGED
|
@@ -28,11 +28,17 @@ type CacheWriteResult = object;
|
|
|
28
28
|
*
|
|
29
29
|
* @example
|
|
30
30
|
* ```ts
|
|
31
|
-
*
|
|
31
|
+
* import { Spoosh } from "@spoosh/core";
|
|
32
|
+
*
|
|
33
|
+
* const client = new Spoosh<ApiSchema, Error>("/api")
|
|
34
|
+
* .use([
|
|
35
|
+
* // ... other plugins
|
|
36
|
+
* cachePlugin({ staleTime: 5000 }),
|
|
37
|
+
* ]);
|
|
32
38
|
*
|
|
33
39
|
* // Per-query override
|
|
34
40
|
* useRead((api) => api.posts.$get(), {
|
|
35
|
-
* staleTime: 10000,
|
|
41
|
+
* staleTime: 10000,
|
|
36
42
|
* });
|
|
37
43
|
* ```
|
|
38
44
|
*/
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@spoosh/plugin-cache",
|
|
3
|
-
"version": "0.1.
|
|
3
|
+
"version": "0.1.3",
|
|
4
4
|
"description": "Response caching plugin for Spoosh with configurable stale time",
|
|
5
5
|
"license": "MIT",
|
|
6
6
|
"repository": {
|
|
@@ -33,11 +33,11 @@
|
|
|
33
33
|
}
|
|
34
34
|
},
|
|
35
35
|
"peerDependencies": {
|
|
36
|
-
"@spoosh/core": ">=0.
|
|
36
|
+
"@spoosh/core": ">=0.4.0"
|
|
37
37
|
},
|
|
38
38
|
"devDependencies": {
|
|
39
|
-
"@spoosh/core": "0.
|
|
40
|
-
"@spoosh/test-utils": "0.1.
|
|
39
|
+
"@spoosh/core": "0.4.0",
|
|
40
|
+
"@spoosh/test-utils": "0.1.4"
|
|
41
41
|
},
|
|
42
42
|
"scripts": {
|
|
43
43
|
"dev": "tsup --watch",
|