@extra-memoize/extra-disk-cache 0.8.1 → 0.8.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 -1
- package/lib/disk-cache.d.ts +2 -1
- package/lib/disk-cache.js +3 -2
- package/lib/disk-cache.js.map +1 -1
- package/package.json +3 -3
package/README.md
CHANGED
|
@@ -14,7 +14,10 @@ yarn add @extra-memoize/extra-disk-cache
|
|
|
14
14
|
#### DiskCache
|
|
15
15
|
```ts
|
|
16
16
|
class DiskCache<T> implements ICache<T> {
|
|
17
|
-
constructor(
|
|
17
|
+
constructor(
|
|
18
|
+
view: DiskCacheView<string, T>
|
|
19
|
+
, timeToLive?: number
|
|
20
|
+
)
|
|
18
21
|
}
|
|
19
22
|
```
|
|
20
23
|
|
package/lib/disk-cache.d.ts
CHANGED
|
@@ -2,7 +2,8 @@ import { ICache, State } from 'extra-memoize';
|
|
|
2
2
|
import { DiskCacheView } from 'extra-disk-cache';
|
|
3
3
|
export declare class DiskCache<T> implements ICache<T> {
|
|
4
4
|
private view;
|
|
5
|
-
|
|
5
|
+
private timeToLive?;
|
|
6
|
+
constructor(view: DiskCacheView<string, T>, timeToLive?: number | undefined);
|
|
6
7
|
get(key: string): [State.Miss] | [State.Hit, T];
|
|
7
8
|
set(key: string, value: T): void;
|
|
8
9
|
}
|
package/lib/disk-cache.js
CHANGED
|
@@ -4,8 +4,9 @@ exports.DiskCache = void 0;
|
|
|
4
4
|
const extra_memoize_1 = require("extra-memoize");
|
|
5
5
|
const prelude_1 = require("@blackglory/prelude");
|
|
6
6
|
class DiskCache {
|
|
7
|
-
constructor(view) {
|
|
7
|
+
constructor(view, timeToLive) {
|
|
8
8
|
this.view = view;
|
|
9
|
+
this.timeToLive = timeToLive;
|
|
9
10
|
}
|
|
10
11
|
get(key) {
|
|
11
12
|
const item = this.view.getWithMetadata(key);
|
|
@@ -17,7 +18,7 @@ class DiskCache {
|
|
|
17
18
|
}
|
|
18
19
|
}
|
|
19
20
|
set(key, value) {
|
|
20
|
-
this.view.set(key, value,
|
|
21
|
+
this.view.set(key, value, this.timeToLive);
|
|
21
22
|
}
|
|
22
23
|
}
|
|
23
24
|
exports.DiskCache = DiskCache;
|
package/lib/disk-cache.js.map
CHANGED
|
@@ -1 +1 @@
|
|
|
1
|
-
{"version":3,"file":"disk-cache.js","sourceRoot":"","sources":["../src/disk-cache.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAE7C,iDAAiD;AAEjD,MAAa,SAAS;IACpB,
|
|
1
|
+
{"version":3,"file":"disk-cache.js","sourceRoot":"","sources":["../src/disk-cache.ts"],"names":[],"mappings":";;;AAAA,iDAA6C;AAE7C,iDAAiD;AAEjD,MAAa,SAAS;IACpB,YACU,IAA8B,EAC9B,UAAmB;QADnB,SAAI,GAAJ,IAAI,CAA0B;QAC9B,eAAU,GAAV,UAAU,CAAS;IAC1B,CAAC;IAEJ,GAAG,CAAC,GAAW;QAGb,MAAM,IAAI,GAAG,IAAI,CAAC,IAAI,CAAC,eAAe,CAAC,GAAG,CAAC,CAAA;QAC3C,IAAI,IAAA,qBAAW,EAAC,IAAI,CAAC,EAAE;YACrB,OAAO,CAAC,qBAAK,CAAC,IAAI,CAAC,CAAA;SACpB;aAAM;YACL,OAAO,CAAC,qBAAK,CAAC,GAAG,EAAE,IAAI,CAAC,KAAK,CAAC,CAAA;SAC/B;IACH,CAAC;IAED,GAAG,CAAC,GAAW,EAAE,KAAQ;QACvB,IAAI,CAAC,IAAI,CAAC,GAAG,CAAC,GAAG,EAAE,KAAK,EAAE,IAAI,CAAC,UAAU,CAAC,CAAA;IAC5C,CAAC;CACF;AApBD,8BAoBC"}
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@extra-memoize/extra-disk-cache",
|
|
3
|
-
"version": "0.8.
|
|
3
|
+
"version": "0.8.3",
|
|
4
4
|
"description": "",
|
|
5
5
|
"files": [
|
|
6
6
|
"lib"
|
|
@@ -48,13 +48,13 @@
|
|
|
48
48
|
"ts-jest": "^29.0.3",
|
|
49
49
|
"tscpaths": "^0.0.9",
|
|
50
50
|
"tslib": "^2.4.1",
|
|
51
|
-
"typescript": "
|
|
51
|
+
"typescript": "4.8"
|
|
52
52
|
},
|
|
53
53
|
"dependencies": {
|
|
54
54
|
"@blackglory/prelude": "^0.2.0"
|
|
55
55
|
},
|
|
56
56
|
"peerDependencies": {
|
|
57
|
-
"extra-disk-cache": "^0.10.1 || ^0.11.1",
|
|
57
|
+
"extra-disk-cache": "^0.10.1 || ^0.11.1 || ^0.12.0",
|
|
58
58
|
"extra-memoize": "^0.6.0 || ^0.7.0 || ^0.8.0 || ^0.9.0"
|
|
59
59
|
}
|
|
60
60
|
}
|