limited-cache 1.1.1 → 2.1.0
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/CHANGELOG.md +19 -5
- package/CODE_OF_CONDUCT.md +103 -47
- package/{CONTRIBUTING.md → CONTRIBUTING.template.md} +4 -2
- package/LICENSE +1 -1
- package/README.md +26 -18
- package/dist/core/LimitedCache.d.ts +4 -3
- package/dist/core/LimitedCache.d.ts.map +1 -0
- package/dist/core/LimitedCache.js +29 -0
- package/dist/core/LimitedCache.js.map +1 -0
- package/dist/core/LimitedCacheObject.d.ts +5 -3
- package/dist/core/LimitedCacheObject.d.ts.map +1 -0
- package/dist/core/LimitedCacheObject.js +52 -0
- package/dist/core/LimitedCacheObject.js.map +1 -0
- package/dist/core/builtIns.d.ts +12 -11
- package/dist/core/builtIns.d.ts.map +1 -0
- package/dist/core/builtIns.js +5 -0
- package/dist/core/builtIns.js.map +1 -0
- package/dist/core/defaultOptions.d.ts +6 -6
- package/dist/core/defaultOptions.d.ts.map +1 -0
- package/dist/core/defaultOptions.js +14 -0
- package/dist/core/defaultOptions.js.map +1 -0
- package/dist/core/limitedCacheUtil.d.ts +13 -12
- package/dist/core/limitedCacheUtil.d.ts.map +1 -0
- package/dist/core/limitedCacheUtil.js +14 -0
- package/dist/core/limitedCacheUtil.js.map +1 -0
- package/dist/core/lowLevelFunctions.d.ts +14 -13
- package/dist/core/lowLevelFunctions.d.ts.map +1 -0
- package/dist/core/lowLevelFunctions.js +240 -0
- package/dist/core/lowLevelFunctions.js.map +1 -0
- package/dist/index.cjs +388 -0
- package/dist/index.d.ts +7 -10
- package/dist/index.d.ts.map +1 -0
- package/dist/index.js +7 -8
- package/dist/index.js.map +1 -0
- package/dist/types.d.ts +58 -60
- package/dist/types.d.ts.map +1 -0
- package/dist/types.js +2 -0
- package/dist/types.js.map +1 -0
- package/package.json +86 -73
- package/src/__tests__/LimitedCache.test.ts +186 -0
- package/src/__tests__/LimitedCacheObject.test.ts +150 -0
- package/src/__tests__/lowLevelFunctions.test.ts +430 -0
- package/src/__tests__/scenarios/keys.test.ts +67 -0
- package/src/__tests__/scenarios/maxCacheSize.test.ts +126 -0
- package/src/__tests__/scenarios/maxCacheTime.test.ts +150 -0
- package/src/__tests__/scenarios/values.test.ts +49 -0
- package/src/__tests__/typeChecks/LimitedCacheObjectTypes.test.ts +70 -0
- package/src/__tests__/typeChecks/LimitedCacheTypes.test.ts +70 -0
- package/src/__tests__/typeChecks/lowLevelFunctionsTypes.test.ts +70 -0
- package/src/core/LimitedCache.ts +1 -1
- package/src/core/LimitedCacheObject.ts +15 -3
- package/src/core/defaultOptions.ts +1 -2
- package/src/core/limitedCacheUtil.ts +1 -1
- package/src/core/lowLevelFunctions.ts +6 -6
- package/src/index.ts +0 -8
- package/dist/limited-cache.cjs.development.js +0 -456
- package/dist/limited-cache.cjs.development.js.map +0 -1
- package/dist/limited-cache.cjs.production.min.js +0 -2
- package/dist/limited-cache.cjs.production.min.js.map +0 -1
- package/dist/limited-cache.esm.js +0 -436
- package/dist/limited-cache.esm.js.map +0 -1
- package/legacy-types/ts3.x/dist/core/LimitedCache.d.ts +0 -3
- package/legacy-types/ts3.x/dist/core/LimitedCacheObject.d.ts +0 -3
- package/legacy-types/ts3.x/dist/core/builtIns.d.ts +0 -11
- package/legacy-types/ts3.x/dist/core/defaultOptions.d.ts +0 -6
- package/legacy-types/ts3.x/dist/core/limitedCacheUtil.d.ts +0 -12
- package/legacy-types/ts3.x/dist/core/lowLevelFunctions.d.ts +0 -13
- package/legacy-types/ts3.x/dist/index.d.ts +0 -10
- package/legacy-types/ts3.x/dist/types.d.ts +0 -60
package/CHANGELOG.md
CHANGED
|
@@ -1,6 +1,22 @@
|
|
|
1
1
|
# Changelog
|
|
2
2
|
|
|
3
|
-
|
|
3
|
+
## 2.1.0
|
|
4
|
+
|
|
5
|
+
### Minor Changes
|
|
6
|
+
|
|
7
|
+
- Update and modernize package build ([#56](https://github.com/spautz/package-template/issues/56)) ([5f210a6](https://github.com/spautz/package-template/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
|
|
8
|
+
- Add NPM provenance via Github actions ([#56](https://github.com/spautz/package-template/issues/56)) ([5f210a6](https://github.com/spautz/package-template/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
|
|
9
|
+
- Confirm support for Node 20 ([#56](https://github.com/spautz/package-template/issues/56)) ([5f210a6](https://github.com/spautz/package-template/commit/5f210a6a5f77cdffe73f004ea4574f4e791e5029))
|
|
10
|
+
|
|
11
|
+
## [2.0.0](https://github.com/spautz/limited-cache/compare/v1.1.1...v2.0.0) (2021-10-23)
|
|
12
|
+
|
|
13
|
+
- Add `getCacheMetaFromObject` for accessing the cacheMeta of a `LimitedCacheObject`: see docs
|
|
14
|
+
- Internal package updates
|
|
15
|
+
- Confirm support for Node 17
|
|
16
|
+
|
|
17
|
+
### BREAKING CHANGES
|
|
18
|
+
|
|
19
|
+
- Drop support for Node 10
|
|
4
20
|
|
|
5
21
|
### [1.1.1](https://github.com/spautz/limited-cache/compare/v1.1.0...v1.1.1) (2021-06-21)
|
|
6
22
|
|
|
@@ -54,14 +70,12 @@ reset to an empty state on next load.
|
|
|
54
70
|
|
|
55
71
|
## [0.4.1](https://github.com/spautz/limited-cache/compare/v0.4.0...v0.4.1) (2020-06-13)
|
|
56
72
|
|
|
57
|
-
|
|
58
|
-
|
|
73
|
+
- Update devDependencies for security, update configs for dev tools
|
|
59
74
|
- No changes expected in limited-cache itself
|
|
60
75
|
|
|
61
76
|
## [0.4.0](https://github.com/spautz/limited-cache/compare/v0.3.0...v0.4.0) (2020-03-14)
|
|
62
77
|
|
|
63
|
-
|
|
64
|
-
|
|
78
|
+
- Update devDependencies, the build system, and the package distribution
|
|
65
79
|
- No changes expected in limited-cache itself
|
|
66
80
|
|
|
67
81
|
## [0.3.0](https://github.com/spautz/limited-cache/compare/v0.2.1...v0.3.0) (2020-02-19)
|
package/CODE_OF_CONDUCT.md
CHANGED
|
@@ -2,75 +2,131 @@
|
|
|
2
2
|
|
|
3
3
|
## Our Pledge
|
|
4
4
|
|
|
5
|
-
|
|
6
|
-
|
|
7
|
-
|
|
8
|
-
|
|
9
|
-
|
|
10
|
-
|
|
5
|
+
We as members, contributors, and leaders pledge to make participation in our
|
|
6
|
+
community a harassment-free experience for everyone, regardless of age, body
|
|
7
|
+
size, visible or invisible disability, ethnicity, sex characteristics, gender
|
|
8
|
+
identity and expression, level of experience, education, socio-economic status,
|
|
9
|
+
nationality, personal appearance, race, caste, color, religion, or sexual identity
|
|
10
|
+
and orientation.
|
|
11
|
+
|
|
12
|
+
We pledge to act and interact in ways that contribute to an open, welcoming,
|
|
13
|
+
diverse, inclusive, and healthy community.
|
|
11
14
|
|
|
12
15
|
## Our Standards
|
|
13
16
|
|
|
14
|
-
Examples of behavior that contributes to
|
|
15
|
-
include:
|
|
17
|
+
Examples of behavior that contributes to a positive environment for our
|
|
18
|
+
community include:
|
|
16
19
|
|
|
17
|
-
-
|
|
18
|
-
- Being respectful of differing viewpoints and experiences
|
|
19
|
-
-
|
|
20
|
-
-
|
|
21
|
-
|
|
20
|
+
- Demonstrating empathy and kindness toward other people
|
|
21
|
+
- Being respectful of differing opinions, viewpoints, and experiences
|
|
22
|
+
- Giving and gracefully accepting constructive feedback
|
|
23
|
+
- Accepting responsibility and apologizing to those affected by our mistakes,
|
|
24
|
+
and learning from the experience
|
|
25
|
+
- Focusing on what is best not just for us as individuals, but for the
|
|
26
|
+
overall community
|
|
22
27
|
|
|
23
|
-
Examples of unacceptable behavior
|
|
28
|
+
Examples of unacceptable behavior include:
|
|
24
29
|
|
|
25
|
-
- The use of sexualized language or imagery and
|
|
26
|
-
advances
|
|
27
|
-
- Trolling, insulting
|
|
30
|
+
- The use of sexualized language or imagery, and sexual attention or
|
|
31
|
+
advances of any kind
|
|
32
|
+
- Trolling, insulting or derogatory comments, and personal or political attacks
|
|
28
33
|
- Public or private harassment
|
|
29
|
-
- Publishing others' private information, such as a physical or
|
|
30
|
-
address, without explicit permission
|
|
34
|
+
- Publishing others' private information, such as a physical or email
|
|
35
|
+
address, without their explicit permission
|
|
31
36
|
- Other conduct which could reasonably be considered inappropriate in a
|
|
32
37
|
professional setting
|
|
33
38
|
|
|
34
|
-
##
|
|
39
|
+
## Enforcement Responsibilities
|
|
35
40
|
|
|
36
|
-
|
|
37
|
-
behavior and
|
|
38
|
-
response to any
|
|
41
|
+
Community leaders are responsible for clarifying and enforcing our standards of
|
|
42
|
+
acceptable behavior and will take appropriate and fair corrective action in
|
|
43
|
+
response to any behavior that they deem inappropriate, threatening, offensive,
|
|
44
|
+
or harmful.
|
|
39
45
|
|
|
40
|
-
|
|
41
|
-
|
|
42
|
-
|
|
43
|
-
|
|
44
|
-
threatening, offensive, or harmful.
|
|
46
|
+
Community leaders have the right and responsibility to remove, edit, or reject
|
|
47
|
+
comments, commits, code, wiki edits, issues, and other contributions that are
|
|
48
|
+
not aligned to this Code of Conduct, and will communicate reasons for moderation
|
|
49
|
+
decisions when appropriate.
|
|
45
50
|
|
|
46
51
|
## Scope
|
|
47
52
|
|
|
48
|
-
This Code of Conduct applies
|
|
49
|
-
|
|
50
|
-
|
|
51
|
-
|
|
52
|
-
representative at an online or offline event.
|
|
53
|
-
further defined and clarified by project maintainers.
|
|
53
|
+
This Code of Conduct applies within all community spaces, and also applies when
|
|
54
|
+
an individual is officially representing the community in public spaces.
|
|
55
|
+
Examples of representing our community include using an official e-mail address,
|
|
56
|
+
posting via an official social media account, or acting as an appointed
|
|
57
|
+
representative at an online or offline event.
|
|
54
58
|
|
|
55
59
|
## Enforcement
|
|
56
60
|
|
|
57
61
|
Instances of abusive, harassing, or otherwise unacceptable behavior may be
|
|
58
|
-
reported
|
|
59
|
-
|
|
60
|
-
|
|
61
|
-
|
|
62
|
-
|
|
62
|
+
reported to the community leaders responsible for enforcement at
|
|
63
|
+
spautz@gmail.com.
|
|
64
|
+
All complaints will be reviewed and investigated promptly and fairly.
|
|
65
|
+
|
|
66
|
+
All community leaders are obligated to respect the privacy and security of the
|
|
67
|
+
reporter of any incident.
|
|
68
|
+
|
|
69
|
+
## Enforcement Guidelines
|
|
70
|
+
|
|
71
|
+
Community leaders will follow these Community Impact Guidelines in determining
|
|
72
|
+
the consequences for any action they deem in violation of this Code of Conduct:
|
|
73
|
+
|
|
74
|
+
### 1. Correction
|
|
75
|
+
|
|
76
|
+
**Community Impact**: Use of inappropriate language or other behavior deemed
|
|
77
|
+
unprofessional or unwelcome in the community.
|
|
78
|
+
|
|
79
|
+
**Consequence**: A private, written warning from community leaders, providing
|
|
80
|
+
clarity around the nature of the violation and an explanation of why the
|
|
81
|
+
behavior was inappropriate. A public apology may be requested.
|
|
82
|
+
|
|
83
|
+
### 2. Warning
|
|
84
|
+
|
|
85
|
+
**Community Impact**: A violation through a single incident or series
|
|
86
|
+
of actions.
|
|
63
87
|
|
|
64
|
-
|
|
65
|
-
|
|
66
|
-
|
|
88
|
+
**Consequence**: A warning with consequences for continued behavior. No
|
|
89
|
+
interaction with the people involved, including unsolicited interaction with
|
|
90
|
+
those enforcing the Code of Conduct, for a specified period of time. This
|
|
91
|
+
includes avoiding interactions in community spaces as well as external channels
|
|
92
|
+
like social media. Violating these terms may lead to a temporary or
|
|
93
|
+
permanent ban.
|
|
94
|
+
|
|
95
|
+
### 3. Temporary Ban
|
|
96
|
+
|
|
97
|
+
**Community Impact**: A serious violation of community standards, including
|
|
98
|
+
sustained inappropriate behavior.
|
|
99
|
+
|
|
100
|
+
**Consequence**: A temporary ban from any sort of interaction or public
|
|
101
|
+
communication with the community for a specified period of time. No public or
|
|
102
|
+
private interaction with the people involved, including unsolicited interaction
|
|
103
|
+
with those enforcing the Code of Conduct, is allowed during this period.
|
|
104
|
+
Violating these terms may lead to a permanent ban.
|
|
105
|
+
|
|
106
|
+
### 4. Permanent Ban
|
|
107
|
+
|
|
108
|
+
**Community Impact**: Demonstrating a pattern of violation of community
|
|
109
|
+
standards, including sustained inappropriate behavior, harassment of an
|
|
110
|
+
individual, or aggression toward or disparagement of classes of individuals.
|
|
111
|
+
|
|
112
|
+
**Consequence**: A permanent ban from any sort of public interaction within
|
|
113
|
+
the community.
|
|
67
114
|
|
|
68
115
|
## Attribution
|
|
69
116
|
|
|
70
|
-
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
71
|
-
available at
|
|
117
|
+
This Code of Conduct is adapted from the [Contributor Covenant][homepage],
|
|
118
|
+
version 2.0, available at
|
|
119
|
+
[https://www.contributor-covenant.org/version/2/0/code_of_conduct.html][v2.0].
|
|
72
120
|
|
|
73
|
-
|
|
121
|
+
Community Impact Guidelines were inspired by
|
|
122
|
+
[Mozilla's code of conduct enforcement ladder][mozilla coc].
|
|
74
123
|
|
|
75
|
-
For answers to common questions about this code of conduct, see
|
|
76
|
-
https://www.contributor-covenant.org/faq
|
|
124
|
+
For answers to common questions about this code of conduct, see the FAQ at
|
|
125
|
+
[https://www.contributor-covenant.org/faq][faq]. Translations are available
|
|
126
|
+
at [https://www.contributor-covenant.org/translations][translations].
|
|
127
|
+
|
|
128
|
+
[homepage]: https://www.contributor-covenant.org
|
|
129
|
+
[v2.0]: https://www.contributor-covenant.org/version/2/0/code_of_conduct.html
|
|
130
|
+
[mozilla coc]: https://github.com/mozilla/diversity
|
|
131
|
+
[faq]: https://www.contributor-covenant.org/faq
|
|
132
|
+
[translations]: https://www.contributor-covenant.org/translations
|
|
@@ -40,11 +40,13 @@ to discuss your idea and make sure it is inline with the project goals.
|
|
|
40
40
|
4. To test your local dev version of `limited-cache` in other projects, [Yalc](https://github.com/whitecolor/yalc)
|
|
41
41
|
is an excellent tool.
|
|
42
42
|
|
|
43
|
-
5. After you have made your changes, submit a pull request. Issues and pull requests are monitored, and you should
|
|
43
|
+
5. After you have made your changes, submit a pull request. Issues and pull requests are monitored, and you should
|
|
44
|
+
receive a reply.
|
|
44
45
|
|
|
45
46
|
## Code and Project Standards
|
|
46
47
|
|
|
47
|
-
Eslint, Typescript, and Prettier enforce most code standards.
|
|
48
|
+
Eslint, Typescript, and Prettier enforce most code standards.
|
|
49
|
+
A pre-push hook will validate the project against those standards.
|
|
48
50
|
|
|
49
51
|
Running `yarn test` will check the code against unit tests and generate a code coverage report (in `coverage/`).
|
|
50
52
|
This project's goal is to be near 100% code coverage.
|
package/LICENSE
CHANGED
package/README.md
CHANGED
|
@@ -4,9 +4,9 @@ A minimal JS cache. Like using an object to store keys and values, except it won
|
|
|
4
4
|
|
|
5
5
|
[](https://www.npmjs.com/package/limited-cache)
|
|
6
6
|
[](https://github.com/spautz/limited-cache/actions)
|
|
7
|
-
[](https://david-dm.org/spautz/limited-cache)
|
|
8
|
-
[](https://bundlephobia.com/result?p=limited-cache)
|
|
9
7
|
[](https://coveralls.io/github/spautz/limited-cache?branch=main)
|
|
8
|
+
[](https://libraries.io/github/spautz/limited-cache)
|
|
9
|
+
[](https://bundlephobia.com/result?p=limited-cache)
|
|
10
10
|
|
|
11
11
|
## Motivation
|
|
12
12
|
|
|
@@ -55,7 +55,7 @@ return {
|
|
|
55
55
|
};
|
|
56
56
|
```
|
|
57
57
|
|
|
58
|
-
Typescript generics,
|
|
58
|
+
Typescript generics, to define a type for items in the cache:
|
|
59
59
|
|
|
60
60
|
```typescript
|
|
61
61
|
const stringCache = LimitedCache<string>();
|
|
@@ -92,23 +92,31 @@ Use a falsy value to disable.
|
|
|
92
92
|
|
|
93
93
|
## Low-level functions
|
|
94
94
|
|
|
95
|
-
|
|
95
|
+
Under the hood, everything is tracked inside a single, serializable object (`cacheMeta`) which can be persisted to
|
|
96
|
+
storage or kept in Redux or any other state.
|
|
96
97
|
|
|
97
|
-
|
|
98
|
-
- `get(cacheMeta, cacheKey)`
|
|
99
|
-
- `getAll(cacheMeta)` - returns the entire cache, excluding expired items
|
|
100
|
-
- `has(cacheMeta, cacheKey)`
|
|
101
|
-
- `set(cacheMeta, cacheKey, value)`
|
|
102
|
-
- `remove(cacheMeta, cacheKey)`
|
|
103
|
-
- `reset(cacheMeta)`
|
|
104
|
-
- `setOptions(cacheMeta, options)` - you can update options anytime
|
|
105
|
-
|
|
106
|
-
You can also import these functions individually, if you want to optimize tree-shaking and minification:
|
|
98
|
+
You can retrieve this object from a LimitedCache or LimitedCacheObject, or create it directly via `lowLevelInit`:
|
|
107
99
|
|
|
108
100
|
```javascript
|
|
109
|
-
|
|
101
|
+
myLimitedCache.getCacheMeta();
|
|
102
|
+
getCacheMetaFromObject(myLimitedCacheObject);
|
|
110
103
|
```
|
|
111
104
|
|
|
105
|
+
Do not manipulate cacheMeta directly: a set of low-level functions is available for that. Every action available
|
|
106
|
+
on the higher-level LimitedCache and LimitedCacheObject is available as a low-level function.
|
|
107
|
+
|
|
108
|
+
- `lowLevelInit(options)`
|
|
109
|
+
- `lowLevelGetOne(cacheMeta, cacheKey)`
|
|
110
|
+
- `lowLevelGetAll(cacheMeta)` - returns the entire cache, excluding expired items
|
|
111
|
+
- `lowLevelHas(cacheMeta, cacheKey)`
|
|
112
|
+
- `lowLevelSet(cacheMeta, cacheKey, value)`
|
|
113
|
+
- `lowLevelRemove(cacheMeta, cacheKey)`
|
|
114
|
+
- `lowLevelReset(cacheMeta)`
|
|
115
|
+
- `lowLevelSetOptions(cacheMeta, options)` - you can update options anytime
|
|
116
|
+
|
|
117
|
+
These functions are also grouped together as [limitedCacheUtil](https://github.com/spautz/limited-cache/blob/main/src/core/limitedCacheUtil.ts#L13-L23) --
|
|
118
|
+
but minimization and tree-shaking will be slightly better if you import each individually.
|
|
119
|
+
|
|
112
120
|
## FAQ
|
|
113
121
|
|
|
114
122
|
**Immutable?**
|
|
@@ -125,7 +133,7 @@ When new items are added, or if you try to `get` an item that has expired.
|
|
|
125
133
|
|
|
126
134
|
**Is this a least-recently-used cache?**
|
|
127
135
|
|
|
128
|
-
|
|
136
|
+
Not by default: For performance it only tracks by `set` time.
|
|
129
137
|
|
|
130
|
-
|
|
131
|
-
|
|
138
|
+
You can turn it into a least-recently-used cache by calling `set` each time you `get` an item, though: items will then
|
|
139
|
+
expire based on when they were last accessed. This case has been optimized so performance won't suffer.
|
|
@@ -1,3 +1,4 @@
|
|
|
1
|
-
import { LimitedCacheInstance } from '../types';
|
|
2
|
-
declare const LimitedCache: <ItemType = any>(options?:
|
|
3
|
-
export
|
|
1
|
+
import { LimitedCacheOptions, LimitedCacheInstance } from '../types';
|
|
2
|
+
declare const LimitedCache: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheInstance<ItemType>;
|
|
3
|
+
export { LimitedCache };
|
|
4
|
+
//# sourceMappingURL=LimitedCache.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimitedCache.d.ts","sourceRoot":"","sources":["../../src/core/LimitedCache.ts"],"names":[],"mappings":"AAWA,OAAO,EACL,mBAAmB,EAEnB,oBAAoB,EAGrB,MAAM,UAAU,CAAC;AAUlB,QAAA,MAAM,YAAY,6BACN,mBAAmB,mCAsB9B,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -0,0 +1,29 @@
|
|
|
1
|
+
import { lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelSetOptions, lowLevelDoMaintenance, } from './lowLevelFunctions';
|
|
2
|
+
// Most public functions just call a low-level function directly, passing the cacheMeta.
|
|
3
|
+
// Doing this via a helper function makes the typeChecks easier, and minifies better.
|
|
4
|
+
const bindFunctionToCacheMeta = (
|
|
5
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
6
|
+
fn, cacheMeta) => fn.bind(null, cacheMeta);
|
|
7
|
+
const LimitedCache = (options) => {
|
|
8
|
+
const cacheMeta = lowLevelInit(options);
|
|
9
|
+
return {
|
|
10
|
+
get: bindFunctionToCacheMeta(lowLevelGetOne, cacheMeta),
|
|
11
|
+
getAll: bindFunctionToCacheMeta(lowLevelGetAll, cacheMeta),
|
|
12
|
+
has: bindFunctionToCacheMeta(lowLevelHas, cacheMeta),
|
|
13
|
+
set: (cacheKey, item) => {
|
|
14
|
+
lowLevelSet(cacheMeta, cacheKey, item);
|
|
15
|
+
return item;
|
|
16
|
+
},
|
|
17
|
+
remove: (cacheKey) => {
|
|
18
|
+
lowLevelRemove(cacheMeta, cacheKey);
|
|
19
|
+
return true;
|
|
20
|
+
},
|
|
21
|
+
reset: bindFunctionToCacheMeta(lowLevelReset, cacheMeta),
|
|
22
|
+
getCacheMeta: () => cacheMeta,
|
|
23
|
+
getOptions: () => cacheMeta.options,
|
|
24
|
+
setOptions: bindFunctionToCacheMeta(lowLevelSetOptions, cacheMeta),
|
|
25
|
+
doMaintenance: bindFunctionToCacheMeta(lowLevelDoMaintenance, cacheMeta),
|
|
26
|
+
};
|
|
27
|
+
};
|
|
28
|
+
export { LimitedCache };
|
|
29
|
+
//# sourceMappingURL=LimitedCache.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimitedCache.js","sourceRoot":"","sources":["../../src/core/LimitedCache.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,kBAAkB,EAClB,qBAAqB,GACtB,MAAM,qBAAqB,CAAC;AAS7B,wFAAwF;AACxF,qFAAqF;AACrF,MAAM,uBAAuB,GAAG;AAC9B,8DAA8D;AAC9D,EAAqE,EACrE,SAAqC,EACrC,EAAE,CAAC,EAAE,CAAC,IAAI,CAAC,IAAI,EAAE,SAAS,CAAC,CAAC;AAE9B,MAAM,YAAY,GAAG,CACnB,OAA6B,EACG,EAAE;IAClC,MAAM,SAAS,GAAG,YAAY,CAAW,OAAO,CAAC,CAAC;IAElD,OAAO;QACL,GAAG,EAAE,uBAAuB,CAAW,cAAc,EAAE,SAAS,CAAC;QACjE,MAAM,EAAE,uBAAuB,CAAW,cAAc,EAAE,SAAS,CAAC;QACpE,GAAG,EAAE,uBAAuB,CAAW,WAAW,EAAE,SAAS,CAAC;QAC9D,GAAG,EAAE,CAAC,QAAQ,EAAE,IAAI,EAAY,EAAE;YAChC,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;YACvC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,MAAM,EAAE,CAAC,QAAQ,EAAQ,EAAE;YACzB,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;YACpC,OAAO,IAAI,CAAC;QACd,CAAC;QACD,KAAK,EAAE,uBAAuB,CAAW,aAAa,EAAE,SAAS,CAAC;QAClE,YAAY,EAAE,GAA+B,EAAE,CAAC,SAAS;QACzD,UAAU,EAAE,GAAgC,EAAE,CAAC,SAAS,CAAC,OAAO;QAChE,UAAU,EAAE,uBAAuB,CAAW,kBAAkB,EAAE,SAAS,CAAC;QAC5E,aAAa,EAAE,uBAAuB,CAAW,qBAAqB,EAAE,SAAS,CAAC;KACnF,CAAC;AACJ,CAAC,CAAC;AAEF,OAAO,EAAE,YAAY,EAAE,CAAC"}
|
|
@@ -1,3 +1,5 @@
|
|
|
1
|
-
import { LimitedCacheObjectInstance } from '../types';
|
|
2
|
-
declare const LimitedCacheObject: <ItemType = any>(options?:
|
|
3
|
-
|
|
1
|
+
import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types';
|
|
2
|
+
declare const LimitedCacheObject: <ItemType = any>(options?: LimitedCacheOptions) => LimitedCacheObjectInstance<ItemType>;
|
|
3
|
+
declare const getCacheMetaFromObject: (instance: LimitedCacheObjectInstance) => LimitedCacheMeta;
|
|
4
|
+
export { LimitedCacheObject, getCacheMetaFromObject };
|
|
5
|
+
//# sourceMappingURL=LimitedCacheObject.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimitedCacheObject.d.ts","sourceRoot":"","sources":["../../src/core/LimitedCacheObject.ts"],"names":[],"mappings":"AASA,OAAO,EACL,mBAAmB,EACnB,0BAA0B,EAC1B,gBAAgB,EAEjB,MAAM,UAAU,CAAC;AA4ClB,QAAA,MAAM,kBAAkB,6BACZ,mBAAmB,yCAO9B,CAAC;AAEF,QAAA,MAAM,sBAAsB,aAAc,0BAA0B,KAAG,gBAEtE,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
|
|
@@ -0,0 +1,52 @@
|
|
|
1
|
+
import { hasOwnProperty } from './builtIns';
|
|
2
|
+
import { lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, } from './lowLevelFunctions';
|
|
3
|
+
// The `any` here doesn't escape out anywhere: it's overridden by the constructor below
|
|
4
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
5
|
+
const proxyHandler = {
|
|
6
|
+
get: (cacheMeta, cacheKey) => {
|
|
7
|
+
if (cacheKey === 'hasOwnProperty') {
|
|
8
|
+
return hasOwnProperty;
|
|
9
|
+
}
|
|
10
|
+
return lowLevelGetOne(cacheMeta, cacheKey);
|
|
11
|
+
},
|
|
12
|
+
getOwnPropertyDescriptor: (cacheMeta, cacheKey) => {
|
|
13
|
+
const hasResult = lowLevelHas(cacheMeta, cacheKey);
|
|
14
|
+
const getResult = lowLevelGetOne(cacheMeta, cacheKey);
|
|
15
|
+
if (hasResult) {
|
|
16
|
+
return {
|
|
17
|
+
configurable: true,
|
|
18
|
+
enumerable: hasResult,
|
|
19
|
+
value: getResult,
|
|
20
|
+
writable: true,
|
|
21
|
+
};
|
|
22
|
+
}
|
|
23
|
+
return;
|
|
24
|
+
},
|
|
25
|
+
has: lowLevelHas,
|
|
26
|
+
// eslint-disable-next-line @typescript-eslint/no-explicit-any
|
|
27
|
+
set: (cacheMeta, cacheKey, item) => {
|
|
28
|
+
lowLevelSet(cacheMeta, cacheKey, item);
|
|
29
|
+
return item;
|
|
30
|
+
},
|
|
31
|
+
deleteProperty: (cacheMeta, cacheKey) => {
|
|
32
|
+
lowLevelRemove(cacheMeta, cacheKey);
|
|
33
|
+
return true;
|
|
34
|
+
},
|
|
35
|
+
ownKeys: (cacheMeta) => Object.keys(lowLevelGetAll(cacheMeta)),
|
|
36
|
+
};
|
|
37
|
+
/**
|
|
38
|
+
* So that we can retrieve the cacheMeta for a LimitedCacheObject, without polluting its properties, each proxy
|
|
39
|
+
* is associated back to its internal cacheMeta here.
|
|
40
|
+
*/
|
|
41
|
+
const cacheMetasForProxies = new WeakMap();
|
|
42
|
+
const LimitedCacheObject = (options) => {
|
|
43
|
+
const cacheMeta = lowLevelInit(options);
|
|
44
|
+
const limitedCacheObject = new Proxy(cacheMeta, proxyHandler);
|
|
45
|
+
cacheMetasForProxies.set(limitedCacheObject, cacheMeta);
|
|
46
|
+
return limitedCacheObject;
|
|
47
|
+
};
|
|
48
|
+
const getCacheMetaFromObject = (instance) => {
|
|
49
|
+
return cacheMetasForProxies.get(instance);
|
|
50
|
+
};
|
|
51
|
+
export { LimitedCacheObject, getCacheMetaFromObject };
|
|
52
|
+
//# sourceMappingURL=LimitedCacheObject.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"LimitedCacheObject.js","sourceRoot":"","sources":["../../src/core/LimitedCacheObject.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,cAAc,EAAE,MAAM,YAAY,CAAC;AAC5C,OAAO,EACL,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,GACf,MAAM,qBAAqB,CAAC;AAQ7B,uFAAuF;AACvF,8DAA8D;AAC9D,MAAM,YAAY,GAAkD;IAClE,GAAG,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAE,EAAE;QACrD,IAAI,QAAQ,KAAK,gBAAgB,EAAE;YACjC,OAAO,cAAc,CAAC;SACvB;QACD,OAAO,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;IAC7C,CAAC;IACD,wBAAwB,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAE,EAAE;QAC1E,MAAM,SAAS,GAAG,WAAW,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACnD,MAAM,SAAS,GAAG,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QAEtD,IAAI,SAAS,EAAE;YACb,OAAO;gBACL,YAAY,EAAE,IAAI;gBAClB,UAAU,EAAE,SAAS;gBACrB,KAAK,EAAE,SAAS;gBAChB,QAAQ,EAAE,IAAI;aACf,CAAC;SACH;QACD,OAAO;IACT,CAAC;IACD,GAAG,EAAE,WAAW;IAChB,8DAA8D;IAC9D,GAAG,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAE,IAAS,EAAO,EAAE;QACrE,WAAW,CAAC,SAAS,EAAE,QAAQ,EAAE,IAAI,CAAC,CAAC;QACvC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,cAAc,EAAE,CAAC,SAA2B,EAAE,QAAgB,EAAQ,EAAE;QACtE,cAAc,CAAC,SAAS,EAAE,QAAQ,CAAC,CAAC;QACpC,OAAO,IAAI,CAAC;IACd,CAAC;IACD,OAAO,EAAE,CAAC,SAA2B,EAAE,EAAE,CAAC,MAAM,CAAC,IAAI,CAAC,cAAc,CAAC,SAAS,CAAC,CAAC;CACjF,CAAC;AAEF;;;GAGG;AACH,MAAM,oBAAoB,GAAG,IAAI,OAAO,EAAE,CAAC;AAE3C,MAAM,kBAAkB,GAAG,CACzB,OAA6B,EACS,EAAE;IACxC,MAAM,SAAS,GAAG,YAAY,CAAC,OAAO,CAAC,CAAC;IACxC,MAAM,kBAAkB,GAAG,IAAI,KAAK,CAAC,SAAS,EAAE,YAAY,CAAC,CAAC;IAE9D,oBAAoB,CAAC,GAAG,CAAC,kBAAkB,EAAE,SAAS,CAAC,CAAC;IACxD,OAAO,kBAAkB,CAAC;AAC5B,CAAC,CAAC;AAEF,MAAM,sBAAsB,GAAG,CAAC,QAAoC,EAAoB,EAAE;IACxF,OAAO,oBAAoB,CAAC,GAAG,CAAC,QAAQ,CAAC,CAAC;AAC5C,CAAC,CAAC;AAEF,OAAO,EAAE,kBAAkB,EAAE,sBAAsB,EAAE,CAAC"}
|
package/dist/core/builtIns.d.ts
CHANGED
|
@@ -1,11 +1,12 @@
|
|
|
1
|
-
declare const objectCreate: {
|
|
2
|
-
(o: object | null): any;
|
|
3
|
-
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
4
|
-
}, objectAssign: {
|
|
5
|
-
<T, U>(target: T, source: U): T & U;
|
|
6
|
-
<T_1, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
7
|
-
<T_2, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
8
|
-
(target: object, ...sources: any[]): any;
|
|
9
|
-
}, hasOwnProperty: (v:
|
|
10
|
-
declare const dateNow: () => number;
|
|
11
|
-
export { objectAssign, objectCreate, dateNow, hasOwnProperty };
|
|
1
|
+
declare const objectCreate: {
|
|
2
|
+
(o: object | null): any;
|
|
3
|
+
(o: object | null, properties: PropertyDescriptorMap & ThisType<any>): any;
|
|
4
|
+
}, objectAssign: {
|
|
5
|
+
<T extends {}, U>(target: T, source: U): T & U;
|
|
6
|
+
<T_1 extends {}, U_1, V>(target: T_1, source1: U_1, source2: V): T_1 & U_1 & V;
|
|
7
|
+
<T_2 extends {}, U_2, V_1, W>(target: T_2, source1: U_2, source2: V_1, source3: W): T_2 & U_2 & V_1 & W;
|
|
8
|
+
(target: object, ...sources: any[]): any;
|
|
9
|
+
}, hasOwnProperty: (v: PropertyKey) => boolean;
|
|
10
|
+
declare const dateNow: () => number;
|
|
11
|
+
export { objectAssign, objectCreate, dateNow, hasOwnProperty };
|
|
12
|
+
//# sourceMappingURL=builtIns.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtIns.d.ts","sourceRoot":"","sources":["../../src/core/builtIns.ts"],"names":[],"mappings":"AACA,QAAA,MACU,YAAY;;;GACZ,YAAY;;;;;GACP,cAAc,6BACnB,CAAC;AACX,QAAA,MAAM,OAAO,cAAW,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"builtIns.js","sourceRoot":"","sources":["../../src/core/builtIns.ts"],"names":[],"mappings":"AAAA,uBAAuB;AACvB,MAAM,EACJ,MAAM,EAAE,YAAY,EACpB,MAAM,EAAE,YAAY,EACpB,SAAS,EAAE,EAAE,cAAc,EAAE,GAC9B,GAAG,MAAM,CAAC;AACX,MAAM,OAAO,GAAG,IAAI,CAAC,GAAG,CAAC;AAEzB,OAAO,EAAE,YAAY,EAAE,YAAY,EAAE,OAAO,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
import { LimitedCacheOptionsReadonly } from '../types';
|
|
2
|
-
declare const CURRENT_META_VERSION = 2;
|
|
3
|
-
declare const MAXIMUM_CACHE_TIME: number;
|
|
4
|
-
declare const defaultOptions: LimitedCacheOptionsReadonly;
|
|
5
|
-
export
|
|
6
|
-
|
|
1
|
+
import { LimitedCacheOptionsReadonly } from '../types';
|
|
2
|
+
declare const CURRENT_META_VERSION = 2;
|
|
3
|
+
declare const MAXIMUM_CACHE_TIME: number;
|
|
4
|
+
declare const defaultOptions: LimitedCacheOptionsReadonly;
|
|
5
|
+
export { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions };
|
|
6
|
+
//# sourceMappingURL=defaultOptions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultOptions.d.ts","sourceRoot":"","sources":["../../src/core/defaultOptions.ts"],"names":[],"mappings":"AAAA,OAAO,EAAE,2BAA2B,EAAE,MAAM,UAAU,CAAC;AAEvD,QAAA,MAAM,oBAAoB,IAAI,CAAC;AAC/B,QAAA,MAAM,kBAAkB,QAAqB,CAAC;AAE9C,QAAA,MAAM,cAAc,EAAE,2BASrB,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
const CURRENT_META_VERSION = 2;
|
|
2
|
+
const MAXIMUM_CACHE_TIME = 365 * 86400 * 1000;
|
|
3
|
+
const defaultOptions = {
|
|
4
|
+
// Public
|
|
5
|
+
maxCacheSize: 100,
|
|
6
|
+
maxCacheTime: 86400 * 1000,
|
|
7
|
+
// Development-only
|
|
8
|
+
warnIfItemPurgedBeforeTime: 5000,
|
|
9
|
+
// Private
|
|
10
|
+
opLimit: 200,
|
|
11
|
+
scanLimit: 50,
|
|
12
|
+
};
|
|
13
|
+
export { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions };
|
|
14
|
+
//# sourceMappingURL=defaultOptions.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"defaultOptions.js","sourceRoot":"","sources":["../../src/core/defaultOptions.ts"],"names":[],"mappings":"AAEA,MAAM,oBAAoB,GAAG,CAAC,CAAC;AAC/B,MAAM,kBAAkB,GAAG,GAAG,GAAG,KAAK,GAAG,IAAI,CAAC;AAE9C,MAAM,cAAc,GAAgC;IAClD,SAAS;IACT,YAAY,EAAE,GAAG;IACjB,YAAY,EAAE,KAAK,GAAG,IAAI;IAC1B,mBAAmB;IACnB,0BAA0B,EAAE,IAAI;IAChC,UAAU;IACV,OAAO,EAAE,GAAG;IACZ,SAAS,EAAE,EAAE;CACd,CAAC;AAEF,OAAO,EAAE,oBAAoB,EAAE,kBAAkB,EAAE,cAAc,EAAE,CAAC"}
|
|
@@ -1,12 +1,13 @@
|
|
|
1
|
-
declare const limitedCacheUtil: {
|
|
2
|
-
init: <ItemType = any>(optionsOrCacheMeta?:
|
|
3
|
-
get: <ItemType_1 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
|
|
4
|
-
getAll: <ItemType_2 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
|
|
5
|
-
has: <ItemType_3 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
|
|
6
|
-
set: <ItemType_4 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("..").LimitedCacheMeta<ItemType_4>;
|
|
7
|
-
remove: <ItemType_5 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("..").LimitedCacheMeta<ItemType_5>;
|
|
8
|
-
reset: <ItemType_6 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_6>) => import("..").LimitedCacheMeta<ItemType_6>;
|
|
9
|
-
doMaintenance: <ItemType_7 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_7>) => import("..").LimitedCacheMeta<ItemType_7>;
|
|
10
|
-
setOptions: <ItemType_8 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_8>, options: import("..").LimitedCacheOptions) => Readonly<import("..").LimitedCacheOptionsFull>;
|
|
11
|
-
};
|
|
12
|
-
export
|
|
1
|
+
declare const limitedCacheUtil: {
|
|
2
|
+
init: <ItemType = any>(optionsOrCacheMeta?: import("..").LimitedCacheOptions | import("..").LimitedCacheMeta<ItemType> | undefined) => import("..").LimitedCacheMeta<ItemType>;
|
|
3
|
+
get: <ItemType_1 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
|
|
4
|
+
getAll: <ItemType_2 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
|
|
5
|
+
has: <ItemType_3 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
|
|
6
|
+
set: <ItemType_4 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("..").LimitedCacheMeta<ItemType_4>;
|
|
7
|
+
remove: <ItemType_5 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("..").LimitedCacheMeta<ItemType_5>;
|
|
8
|
+
reset: <ItemType_6 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_6>) => import("..").LimitedCacheMeta<ItemType_6>;
|
|
9
|
+
doMaintenance: <ItemType_7 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_7>) => import("..").LimitedCacheMeta<ItemType_7>;
|
|
10
|
+
setOptions: <ItemType_8 = any>(cacheMeta: import("..").LimitedCacheMeta<ItemType_8>, options: import("..").LimitedCacheOptions) => Readonly<import("..").LimitedCacheOptionsFull>;
|
|
11
|
+
};
|
|
12
|
+
export { limitedCacheUtil };
|
|
13
|
+
//# sourceMappingURL=limitedCacheUtil.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limitedCacheUtil.d.ts","sourceRoot":"","sources":["../../src/core/limitedCacheUtil.ts"],"names":[],"mappings":"AAYA,QAAA,MAAM,gBAAgB;;;;;;;;;;CAUrB,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -0,0 +1,14 @@
|
|
|
1
|
+
import { lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelInit, lowLevelDoMaintenance, lowLevelRemove, lowLevelReset, lowLevelSet, lowLevelSetOptions, } from './lowLevelFunctions';
|
|
2
|
+
const limitedCacheUtil = {
|
|
3
|
+
init: lowLevelInit,
|
|
4
|
+
get: lowLevelGetOne,
|
|
5
|
+
getAll: lowLevelGetAll,
|
|
6
|
+
has: lowLevelHas,
|
|
7
|
+
set: lowLevelSet,
|
|
8
|
+
remove: lowLevelRemove,
|
|
9
|
+
reset: lowLevelReset,
|
|
10
|
+
doMaintenance: lowLevelDoMaintenance,
|
|
11
|
+
setOptions: lowLevelSetOptions,
|
|
12
|
+
};
|
|
13
|
+
export { limitedCacheUtil };
|
|
14
|
+
//# sourceMappingURL=limitedCacheUtil.js.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"limitedCacheUtil.js","sourceRoot":"","sources":["../../src/core/limitedCacheUtil.ts"],"names":[],"mappings":"AAAA,OAAO,EACL,cAAc,EACd,cAAc,EACd,WAAW,EACX,YAAY,EACZ,qBAAqB,EACrB,cAAc,EACd,aAAa,EACb,WAAW,EACX,kBAAkB,GACnB,MAAM,qBAAqB,CAAC;AAE7B,MAAM,gBAAgB,GAAG;IACvB,IAAI,EAAE,YAAY;IAClB,GAAG,EAAE,cAAc;IACnB,MAAM,EAAE,cAAc;IACtB,GAAG,EAAE,WAAW;IAChB,GAAG,EAAE,WAAW;IAChB,MAAM,EAAE,cAAc;IACtB,KAAK,EAAE,aAAa;IACpB,aAAa,EAAE,qBAAqB;IACpC,UAAU,EAAE,kBAAkB;CAC/B,CAAC;AAEF,OAAO,EAAE,gBAAgB,EAAE,CAAC"}
|
|
@@ -1,13 +1,14 @@
|
|
|
1
|
-
import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta
|
|
2
|
-
declare const isCacheMeta: (cacheMeta: LimitedCacheMeta) => boolean;
|
|
3
|
-
declare const upgradeCacheMeta: (cacheMeta: LimitedCacheMeta) => void;
|
|
4
|
-
declare const lowLevelSetOptions: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, options: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
|
|
5
|
-
declare const lowLevelInit: <ItemType = any>(optionsOrCacheMeta?:
|
|
6
|
-
declare const lowLevelDoMaintenance: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
|
|
7
|
-
declare const lowLevelHas: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => boolean;
|
|
8
|
-
declare const lowLevelGetOne: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => ItemType | undefined;
|
|
9
|
-
declare const lowLevelGetAll: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => Record<string, ItemType>;
|
|
10
|
-
declare const lowLevelSet: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string, item: ItemType) => LimitedCacheMeta<ItemType>;
|
|
11
|
-
declare const lowLevelRemove: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => LimitedCacheMeta<ItemType>;
|
|
12
|
-
declare const lowLevelReset: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
|
|
13
|
-
export { isCacheMeta, upgradeCacheMeta, lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelDoMaintenance, lowLevelSetOptions, };
|
|
1
|
+
import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types';
|
|
2
|
+
declare const isCacheMeta: (cacheMeta: LimitedCacheMeta) => boolean;
|
|
3
|
+
declare const upgradeCacheMeta: (cacheMeta: LimitedCacheMeta) => void;
|
|
4
|
+
declare const lowLevelSetOptions: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, options: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
|
|
5
|
+
declare const lowLevelInit: <ItemType = any>(optionsOrCacheMeta?: LimitedCacheOptions | LimitedCacheMeta<ItemType> | undefined) => LimitedCacheMeta<ItemType>;
|
|
6
|
+
declare const lowLevelDoMaintenance: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
|
|
7
|
+
declare const lowLevelHas: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => boolean;
|
|
8
|
+
declare const lowLevelGetOne: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => ItemType | undefined;
|
|
9
|
+
declare const lowLevelGetAll: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => Record<string, ItemType>;
|
|
10
|
+
declare const lowLevelSet: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string, item: ItemType) => LimitedCacheMeta<ItemType>;
|
|
11
|
+
declare const lowLevelRemove: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>, cacheKey: string) => LimitedCacheMeta<ItemType>;
|
|
12
|
+
declare const lowLevelReset: <ItemType = any>(cacheMeta: LimitedCacheMeta<ItemType>) => LimitedCacheMeta<ItemType>;
|
|
13
|
+
export { isCacheMeta, upgradeCacheMeta, lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelDoMaintenance, lowLevelSetOptions, };
|
|
14
|
+
//# sourceMappingURL=lowLevelFunctions.d.ts.map
|
|
@@ -0,0 +1 @@
|
|
|
1
|
+
{"version":3,"file":"lowLevelFunctions.d.ts","sourceRoot":"","sources":["../../src/core/lowLevelFunctions.ts"],"names":[],"mappings":"AAEA,OAAO,EACL,mBAAmB,EACnB,2BAA2B,EAC3B,gBAAgB,EAGjB,MAAM,UAAU,CAAC;AAqBlB,QAAA,MAAM,WAAW,cAAe,gBAAgB,KAAG,OAElD,CAAC;AAEF,QAAA,MAAM,gBAAgB,cAAe,gBAAgB,KAAG,IAWvD,CAAC;AAEF,QAAA,MAAM,kBAAkB,mEAEb,mBAAmB,KAC3B,2BAGF,CAAC;AAEF,QAAA,MAAM,YAAY,mIAkBjB,CAAC;AA0BF,QAAA,MAAM,qBAAqB,uFA+B1B,CAAC;AA4FF,QAAA,MAAM,WAAW,oEAEL,MAAM,KACf,OAWF,CAAC;AAEF,QAAA,MAAM,cAAc,oEAER,MAAM,yBAOjB,CAAC;AAEF,QAAA,MAAM,cAAc,qFAQnB,CAAC;AAEF,QAAA,MAAM,WAAW,oEAEL,MAAM,+CA+CjB,CAAC;AAEF,QAAA,MAAM,cAAc,oEAER,MAAM,+BAgBjB,CAAC;AAEF,QAAA,MAAM,aAAa,uFAUlB,CAAC;AAEF,OAAO,EACL,WAAW,EACX,gBAAgB,EAChB,YAAY,EACZ,cAAc,EACd,cAAc,EACd,WAAW,EACX,WAAW,EACX,cAAc,EACd,aAAa,EACb,qBAAqB,EACrB,kBAAkB,GACnB,CAAC"}
|