@blaze-cache/axios 0.2.1-beta → 0.2.3-beta
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 +12 -0
- package/package.json +2 -2
package/README.md
CHANGED
|
@@ -65,6 +65,17 @@ response.headers['x-blaze-cache']; // 'HIT' | 'MISS'
|
|
|
65
65
|
* **A cache that throws costs one extra request, never a failed response** — the read and
|
|
66
66
|
the write are both guarded, and the failure is reported once on the console instead of
|
|
67
67
|
turning a good network response into a rejected promise.
|
|
68
|
+
* **Cache activity is observable** — the adapter reads with `cache.get` and writes with
|
|
69
|
+
`cache.set`, so the shared cache's typed event system sees every request it serves:
|
|
70
|
+
|
|
71
|
+
```ts
|
|
72
|
+
cache.on('hit', ({ key }) => console.log('replayed', key));
|
|
73
|
+
cache.on('miss', ({ key }) => console.log('fetched', key));
|
|
74
|
+
cache.on('evict', ({ key }) => console.log('dropped', key));
|
|
75
|
+
```
|
|
76
|
+
|
|
77
|
+
`on` returns its own unsubscribe function; the full event table is in the
|
|
78
|
+
[repository README](https://github.com/blaze-cache/blaze-cache#events).
|
|
68
79
|
|
|
69
80
|
## Testing
|
|
70
81
|
|
|
@@ -90,6 +101,7 @@ Setup, core concepts and the complete axios reference live in the
|
|
|
90
101
|
## Part of Blaze Cache
|
|
91
102
|
|
|
92
103
|
* [`@blaze-cache/core`](https://www.npmjs.com/package/@blaze-cache/core) — the cache itself
|
|
104
|
+
* [`@blaze-cache/fetch`](https://www.npmjs.com/package/@blaze-cache/fetch) — drop-in `fetch()` replacement
|
|
93
105
|
* [`@blaze-cache/react-query`](https://www.npmjs.com/package/@blaze-cache/react-query) — TanStack Query v5 mirror
|
|
94
106
|
|
|
95
107
|
## License
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@blaze-cache/axios",
|
|
3
|
-
"version": "0.2.
|
|
3
|
+
"version": "0.2.3-beta",
|
|
4
4
|
"description": "Cache HTTP responses in axios via a WebAssembly cache — TTLs, tags, Cache-Control support and IndexedDB persistence",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"axios",
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"dist"
|
|
39
39
|
],
|
|
40
40
|
"dependencies": {
|
|
41
|
-
"@blaze-cache/core": "0.2.
|
|
41
|
+
"@blaze-cache/core": "0.2.3-beta"
|
|
42
42
|
},
|
|
43
43
|
"peerDependencies": {
|
|
44
44
|
"axios": "^1.7.0"
|