@amazon/vinyl-cache-manager 1.1.0 → 1.1.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.
Files changed (2) hide show
  1. package/README.md +38 -0
  2. package/package.json +5 -5
package/README.md ADDED
@@ -0,0 +1,38 @@
1
+ # @amazon/vinyl-cache-manager
2
+
3
+ [![Website](https://img.shields.io/badge/website-amazonmusic.github.io%2Fvinyl-blue)](https://amazonmusic.github.io/vinyl)
4
+ [![npm](https://img.shields.io/npm/v/@amazon/vinyl-cache-manager.svg)](https://www.npmjs.com/package/@amazon/vinyl-cache-manager)
5
+ [![size](https://img.shields.io/bundlejs/size/@amazon/vinyl-cache-manager.svg?label=size)](https://bundlejs.com/?q=@amazon/vinyl-cache-manager)
6
+
7
+ A small mediator over the browser
8
+ [Cache API](https://developer.mozilla.org/docs/Web/API/Cache) that adds
9
+ HTTP-style cache-control semantics: TTLs, `stale-while-revalidate`,
10
+ `only-if-cached`, custom cache keys, and validation hooks. Designed to be shared
11
+ between the application and a service worker, with no runtime dependencies.
12
+
13
+ ## Install
14
+
15
+ ```shell
16
+ npm install @amazon/vinyl-cache-manager
17
+ ```
18
+
19
+ ## Usage
20
+
21
+ ```typescript
22
+ import { CacheManager } from '@amazon/vinyl-cache-manager'
23
+
24
+ const cache = new CacheManager({ name: 'media' })
25
+
26
+ const response = await cache.get('https://example.com/segment.m4s', {
27
+ cacheControlDefaults: { maxAge: 60 },
28
+ cacheControlOverrides: { staleWhileRevalidate: 24 * 60 * 60 },
29
+ })
30
+ ```
31
+
32
+ `cacheControlDefaults` apply when the response carries no `Cache-Control`,
33
+ `cacheControlOverrides` always win when reading from cache. POST requests can be
34
+ cached by passing an explicit `cacheKey`.
35
+
36
+ ## License
37
+
38
+ Apache-2.0
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@amazon/vinyl-cache-manager",
3
- "version": "1.1.0",
3
+ "version": "1.1.1",
4
4
  "description": "A mediator for the Cache API",
5
5
  "repository": {
6
6
  "type": "git",
@@ -69,14 +69,14 @@
69
69
  "watch:release": "tsx buildSrc/build.ts --watch --release"
70
70
  },
71
71
  "devDependencies": {
72
- "@amazon/vinyl-build-utils": "^1.1.0",
73
- "@amazon/vinyl-jasmine-wrapper": "^1.1.0"
72
+ "@amazon/vinyl-build-utils": "^1.1.1",
73
+ "@amazon/vinyl-jasmine-wrapper": "^1.1.1"
74
74
  },
75
75
  "dependencies": {
76
- "@amazon/vinyl-util": "^1.1.0"
76
+ "@amazon/vinyl-util": "^1.1.1"
77
77
  },
78
78
  "browserslist": [
79
79
  "defaults, chrome 52, firefox 54, edge 15, safari 8"
80
80
  ],
81
- "gitHead": "ea13070fb52c1903723f08f31c356465d2f3279e"
81
+ "gitHead": "e5a3429d802564132b16808a5b8a8e15a023a548"
82
82
  }