limited-cache 2.2.0 → 2.3.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.
- package/CHANGELOG.md +12 -0
- package/README.md +4 -3
- package/dist/cjs/index.cjs +273 -380
- package/dist/cjs/index.d.cts +84 -76
- package/dist/cjs/index.d.cts.map +1 -0
- package/dist/esm/index.d.ts +99 -6
- package/dist/esm/index.d.ts.map +1 -1
- package/dist/esm/index.js +279 -6
- package/dist/esm/index.js.map +1 -1
- package/package.json +34 -53
- package/src/__tests__/LimitedCache.test.ts +2 -2
- package/src/__tests__/LimitedCacheObject.test.ts +30 -27
- package/src/__tests__/lowLevelFunctions.test.ts +10 -8
- package/src/__tests__/scenarios/keys.test.ts +2 -2
- package/src/__tests__/scenarios/maxCacheSize.test.ts +8 -5
- package/src/__tests__/scenarios/maxCacheTime.test.ts +58 -58
- package/src/__tests__/scenarios/values.test.ts +2 -2
- package/src/__tests__/typeChecks/LimitedCacheObjectTypes.test.ts +15 -15
- package/src/__tests__/typeChecks/LimitedCacheTypes.test.ts +1 -1
- package/src/__tests__/typeChecks/lowLevelFunctionsTypes.test.ts +2 -2
- package/src/core/LimitedCache.ts +20 -21
- package/src/core/LimitedCacheObject.ts +30 -19
- package/src/core/defaultOptions.ts +5 -4
- package/src/core/limitedCacheUtil.ts +15 -3
- package/src/core/lowLevelFunctions.ts +43 -32
- package/src/types.ts +4 -3
- package/dist/esm/core/LimitedCache.d.ts +0 -4
- package/dist/esm/core/LimitedCache.d.ts.map +0 -1
- package/dist/esm/core/LimitedCache.js +0 -29
- package/dist/esm/core/LimitedCache.js.map +0 -1
- package/dist/esm/core/LimitedCacheObject.d.ts +0 -5
- package/dist/esm/core/LimitedCacheObject.d.ts.map +0 -1
- package/dist/esm/core/LimitedCacheObject.js +0 -52
- package/dist/esm/core/LimitedCacheObject.js.map +0 -1
- package/dist/esm/core/builtIns.d.ts +0 -12
- package/dist/esm/core/builtIns.d.ts.map +0 -1
- package/dist/esm/core/builtIns.js +0 -5
- package/dist/esm/core/builtIns.js.map +0 -1
- package/dist/esm/core/defaultOptions.d.ts +0 -6
- package/dist/esm/core/defaultOptions.d.ts.map +0 -1
- package/dist/esm/core/defaultOptions.js +0 -14
- package/dist/esm/core/defaultOptions.js.map +0 -1
- package/dist/esm/core/limitedCacheUtil.d.ts +0 -13
- package/dist/esm/core/limitedCacheUtil.d.ts.map +0 -1
- package/dist/esm/core/limitedCacheUtil.js +0 -14
- package/dist/esm/core/limitedCacheUtil.js.map +0 -1
- package/dist/esm/core/lowLevelFunctions.d.ts +0 -14
- package/dist/esm/core/lowLevelFunctions.d.ts.map +0 -1
- package/dist/esm/core/lowLevelFunctions.js +0 -240
- package/dist/esm/core/lowLevelFunctions.js.map +0 -1
- package/dist/esm/types.d.ts +0 -58
- package/dist/esm/types.d.ts.map +0 -1
- package/dist/esm/types.js +0 -2
- package/dist/esm/types.js.map +0 -1
- package/legacy-types/ts3.5/dist/esm/core/LimitedCache.d.ts +0 -4
- package/legacy-types/ts3.5/dist/esm/core/LimitedCacheObject.d.ts +0 -5
- package/legacy-types/ts3.5/dist/esm/core/builtIns.d.ts +0 -12
- package/legacy-types/ts3.5/dist/esm/core/defaultOptions.d.ts +0 -6
- package/legacy-types/ts3.5/dist/esm/core/limitedCacheUtil.d.ts +0 -13
- package/legacy-types/ts3.5/dist/esm/core/lowLevelFunctions.d.ts +0 -14
- package/legacy-types/ts3.5/dist/esm/index.d.ts +0 -7
- package/legacy-types/ts3.5/dist/esm/types.d.ts +0 -61
- package/legacy-types/ts4.0/dist/esm/core/LimitedCache.d.ts +0 -4
- package/legacy-types/ts4.0/dist/esm/core/LimitedCacheObject.d.ts +0 -5
- package/legacy-types/ts4.0/dist/esm/core/builtIns.d.ts +0 -12
- package/legacy-types/ts4.0/dist/esm/core/defaultOptions.d.ts +0 -6
- package/legacy-types/ts4.0/dist/esm/core/limitedCacheUtil.d.ts +0 -13
- package/legacy-types/ts4.0/dist/esm/core/lowLevelFunctions.d.ts +0 -14
- package/legacy-types/ts4.0/dist/esm/index.d.ts +0 -7
- package/legacy-types/ts4.0/dist/esm/types.d.ts +0 -61
- package/legacy-types/ts4.5/dist/esm/core/LimitedCache.d.ts +0 -4
- package/legacy-types/ts4.5/dist/esm/core/LimitedCacheObject.d.ts +0 -5
- package/legacy-types/ts4.5/dist/esm/core/builtIns.d.ts +0 -12
- package/legacy-types/ts4.5/dist/esm/core/defaultOptions.d.ts +0 -6
- package/legacy-types/ts4.5/dist/esm/core/limitedCacheUtil.d.ts +0 -13
- package/legacy-types/ts4.5/dist/esm/core/lowLevelFunctions.d.ts +0 -14
- package/legacy-types/ts4.5/dist/esm/index.d.ts +0 -7
- package/legacy-types/ts4.5/dist/esm/types.d.ts +0 -61
- package/src/core/builtIns.ts +0 -9
|
@@ -1,240 +0,0 @@
|
|
|
1
|
-
import { objectAssign, objectCreate, dateNow, hasOwnProperty } from './builtIns.js';
|
|
2
|
-
import { CURRENT_META_VERSION, MAXIMUM_CACHE_TIME, defaultOptions } from './defaultOptions.js';
|
|
3
|
-
/* Initialization and options */
|
|
4
|
-
const positiveNumberOrZero = (value) => Math.max(value, 0) || 0;
|
|
5
|
-
const normalizeOptions = (cacheMetaOptions) => {
|
|
6
|
-
objectAssign(cacheMetaOptions, {
|
|
7
|
-
maxCacheSize: positiveNumberOrZero(cacheMetaOptions.maxCacheSize),
|
|
8
|
-
maxCacheTime: positiveNumberOrZero(cacheMetaOptions.maxCacheTime),
|
|
9
|
-
opLimit: positiveNumberOrZero(cacheMetaOptions.opLimit),
|
|
10
|
-
});
|
|
11
|
-
if (process.env.NODE_ENV !== 'production') {
|
|
12
|
-
cacheMetaOptions.warnIfItemPurgedBeforeTime = positiveNumberOrZero(cacheMetaOptions.warnIfItemPurgedBeforeTime);
|
|
13
|
-
}
|
|
14
|
-
return cacheMetaOptions;
|
|
15
|
-
};
|
|
16
|
-
const isCacheMeta = (cacheMeta) => {
|
|
17
|
-
return !!cacheMeta && !!cacheMeta.limitedCacheMetaVersion;
|
|
18
|
-
};
|
|
19
|
-
const upgradeCacheMeta = (cacheMeta) => {
|
|
20
|
-
if (!isCacheMeta(cacheMeta)) {
|
|
21
|
-
throw new Error('Limited-cache metadata is missing: please check your usage');
|
|
22
|
-
}
|
|
23
|
-
if (cacheMeta.limitedCacheMetaVersion !== CURRENT_META_VERSION) {
|
|
24
|
-
// Version is out of date! (Today the only prior version is 1)
|
|
25
|
-
// Version 1: Cache meta cannot be migrated because timestamps and keys are incompatible
|
|
26
|
-
console.warn('Limited-cache metadata is from an incompatible version (1). It must be reset.');
|
|
27
|
-
cacheMeta.limitedCacheMetaVersion = CURRENT_META_VERSION;
|
|
28
|
-
lowLevelReset(cacheMeta);
|
|
29
|
-
}
|
|
30
|
-
};
|
|
31
|
-
const lowLevelSetOptions = (cacheMeta, options) => {
|
|
32
|
-
upgradeCacheMeta(cacheMeta);
|
|
33
|
-
return normalizeOptions(objectAssign(cacheMeta.options, options));
|
|
34
|
-
};
|
|
35
|
-
const lowLevelInit = (optionsOrCacheMeta) => {
|
|
36
|
-
if (isCacheMeta(optionsOrCacheMeta)) {
|
|
37
|
-
const existingCacheMeta = optionsOrCacheMeta;
|
|
38
|
-
upgradeCacheMeta(existingCacheMeta);
|
|
39
|
-
return existingCacheMeta;
|
|
40
|
-
}
|
|
41
|
-
// Else: it's options
|
|
42
|
-
const fullOptions = normalizeOptions({ ...defaultOptions, ...optionsOrCacheMeta });
|
|
43
|
-
// The cacheMeta is created once, and persists per instance
|
|
44
|
-
const newCacheMeta = lowLevelReset({
|
|
45
|
-
limitedCacheMetaVersion: CURRENT_META_VERSION,
|
|
46
|
-
options: fullOptions,
|
|
47
|
-
});
|
|
48
|
-
return newCacheMeta;
|
|
49
|
-
};
|
|
50
|
-
/* Internal cache manipulation */
|
|
51
|
-
const _getExpireTime = (cacheMeta, cacheKey) => {
|
|
52
|
-
const { options: { maxCacheTime }, keyInfo: { [cacheKey]: keyInfo }, } = cacheMeta;
|
|
53
|
-
if (!keyInfo) {
|
|
54
|
-
// A missing record is always treated as expired
|
|
55
|
-
return 0;
|
|
56
|
-
}
|
|
57
|
-
// If we have an exact expireTime then honor it. Otherwise it'll depend on the current maxCacheTime.
|
|
58
|
-
const [setTime, expireTime] = keyInfo;
|
|
59
|
-
return expireTime || setTime + (maxCacheTime || MAXIMUM_CACHE_TIME);
|
|
60
|
-
};
|
|
61
|
-
const _cacheKeyHasExpired = (cacheMeta, cacheKey, now) => {
|
|
62
|
-
return _getExpireTime(cacheMeta, cacheKey) < now;
|
|
63
|
-
};
|
|
64
|
-
const lowLevelDoMaintenance = (cacheMeta) => {
|
|
65
|
-
upgradeCacheMeta(cacheMeta);
|
|
66
|
-
const { cache, keyList, keyInfo } = cacheMeta;
|
|
67
|
-
const now = dateNow();
|
|
68
|
-
// Rebuild cache from keyList only, checking timestamps to auto-remove expired
|
|
69
|
-
const [newCache, newKeyList, newKeyInfo] = keyList.reduce((acc, cacheKey) => {
|
|
70
|
-
const [accCache, accKeyList, accKeyInfo] = acc;
|
|
71
|
-
if (!_cacheKeyHasExpired(cacheMeta, cacheKey, now)) {
|
|
72
|
-
accCache[cacheKey] = cache[cacheKey];
|
|
73
|
-
accKeyList.push(cacheKey);
|
|
74
|
-
accKeyInfo[cacheKey] = keyInfo[cacheKey];
|
|
75
|
-
}
|
|
76
|
-
return acc;
|
|
77
|
-
}, [
|
|
78
|
-
{},
|
|
79
|
-
[],
|
|
80
|
-
objectCreate(null),
|
|
81
|
-
]);
|
|
82
|
-
return objectAssign(cacheMeta, {
|
|
83
|
-
cache: newCache,
|
|
84
|
-
keyList: newKeyList,
|
|
85
|
-
keyInfo: newKeyInfo,
|
|
86
|
-
opsLeft: cacheMeta.options.opLimit,
|
|
87
|
-
});
|
|
88
|
-
};
|
|
89
|
-
const _removeFromIndex = (cacheMeta, startIndex, now) => {
|
|
90
|
-
const { cache, keyList, keyInfo } = cacheMeta;
|
|
91
|
-
// Always remove the item requested, and also remove any neighbors who have expired
|
|
92
|
-
let nextIndex = startIndex;
|
|
93
|
-
let nextCacheKey = keyList[startIndex];
|
|
94
|
-
const keyListLength = keyList.length;
|
|
95
|
-
do {
|
|
96
|
-
// Remove the 'next' item
|
|
97
|
-
cache[nextCacheKey] = keyInfo[nextCacheKey] = undefined;
|
|
98
|
-
// Now advance and decide whether to keep going
|
|
99
|
-
nextIndex++;
|
|
100
|
-
nextCacheKey = keyList[nextIndex];
|
|
101
|
-
} while (nextIndex < keyListLength && _cacheKeyHasExpired(cacheMeta, nextCacheKey, now));
|
|
102
|
-
// Remove the index for everything from the startIndex until we stopped
|
|
103
|
-
keyList.splice(startIndex, nextIndex - startIndex);
|
|
104
|
-
};
|
|
105
|
-
const _removeItemsToMakeRoom = (cacheMeta, now) => {
|
|
106
|
-
const { options: { scanLimit, warnIfItemPurgedBeforeTime }, cache, keyList, keyInfo, } = cacheMeta;
|
|
107
|
-
// These track the soonest-to-expire thing we've found. It may not actually be "oldest".
|
|
108
|
-
// By default we'll remove the item at the head of the queue, unless we find something better.
|
|
109
|
-
let oldestItemIndex = 0;
|
|
110
|
-
let oldestExpireTime = _getExpireTime(cacheMeta, keyList[0]);
|
|
111
|
-
if (oldestExpireTime > now) {
|
|
112
|
-
// The head of the list hasn't yet expired: scan for a better candidate to remove
|
|
113
|
-
let indexToCheck = 0;
|
|
114
|
-
const maxIndexToCheck = Math.min(keyList.length, scanLimit);
|
|
115
|
-
while (indexToCheck < maxIndexToCheck) {
|
|
116
|
-
const cacheKeyForIndex = keyList[indexToCheck];
|
|
117
|
-
const expireTimeForIndex = _getExpireTime(cacheMeta, cacheKeyForIndex);
|
|
118
|
-
// We only consider it if it's eligible for expiration: otherwise it can't be a better option
|
|
119
|
-
// than the default head-of-queue
|
|
120
|
-
if (expireTimeForIndex < now) {
|
|
121
|
-
// We found an expired item! This wins automatically
|
|
122
|
-
oldestItemIndex = indexToCheck;
|
|
123
|
-
oldestExpireTime = 0;
|
|
124
|
-
break;
|
|
125
|
-
}
|
|
126
|
-
if (expireTimeForIndex < oldestExpireTime) {
|
|
127
|
-
// We have a new leader
|
|
128
|
-
oldestItemIndex = indexToCheck;
|
|
129
|
-
oldestExpireTime = expireTimeForIndex;
|
|
130
|
-
}
|
|
131
|
-
indexToCheck += 1;
|
|
132
|
-
}
|
|
133
|
-
}
|
|
134
|
-
// Warn if the 'oldest' item is more recent than we'd like: this means it cycled into and out of
|
|
135
|
-
// cache too quickly for the cache to be useful.
|
|
136
|
-
if (process.env.NODE_ENV !== 'production' &&
|
|
137
|
-
warnIfItemPurgedBeforeTime &&
|
|
138
|
-
oldestExpireTime > now) {
|
|
139
|
-
const oldestItemKey = keyList[oldestItemIndex];
|
|
140
|
-
const [oldestItemSetTime, oldestItemExpireTime] = keyInfo[oldestItemKey];
|
|
141
|
-
if (now - oldestItemSetTime < warnIfItemPurgedBeforeTime) {
|
|
142
|
-
console.warn('Purged an item from cache while it was still fresh: you may want to increase maxCacheSize', {
|
|
143
|
-
currentTime: now,
|
|
144
|
-
key: oldestItemKey,
|
|
145
|
-
item: cache[oldestItemKey],
|
|
146
|
-
setTime: oldestItemSetTime,
|
|
147
|
-
expireTime: oldestItemExpireTime,
|
|
148
|
-
timeInCache: now - oldestItemSetTime,
|
|
149
|
-
});
|
|
150
|
-
}
|
|
151
|
-
}
|
|
152
|
-
// Remove the oldest item we found, plus any expired neighbors
|
|
153
|
-
_removeFromIndex(cacheMeta, oldestItemIndex, now);
|
|
154
|
-
};
|
|
155
|
-
/* Accessors */
|
|
156
|
-
const lowLevelHas = (cacheMeta, cacheKey) => {
|
|
157
|
-
upgradeCacheMeta(cacheMeta);
|
|
158
|
-
const { cache } = cacheMeta;
|
|
159
|
-
if (hasOwnProperty.call(cache, cacheKey) && cache[cacheKey] !== undefined) {
|
|
160
|
-
if (!_cacheKeyHasExpired(cacheMeta, cacheKey, dateNow())) {
|
|
161
|
-
return true;
|
|
162
|
-
}
|
|
163
|
-
// If it's expired, clear the value so that we can short-circuit future lookups
|
|
164
|
-
cache[cacheKey] = undefined;
|
|
165
|
-
}
|
|
166
|
-
return false;
|
|
167
|
-
};
|
|
168
|
-
const lowLevelGetOne = (cacheMeta, cacheKey) => {
|
|
169
|
-
upgradeCacheMeta(cacheMeta);
|
|
170
|
-
if (lowLevelHas(cacheMeta, cacheKey)) {
|
|
171
|
-
return cacheMeta.cache[cacheKey];
|
|
172
|
-
}
|
|
173
|
-
return;
|
|
174
|
-
};
|
|
175
|
-
const lowLevelGetAll = (cacheMeta) => {
|
|
176
|
-
upgradeCacheMeta(cacheMeta);
|
|
177
|
-
// Remove all expired values, and return whatever's left
|
|
178
|
-
lowLevelDoMaintenance(cacheMeta);
|
|
179
|
-
// Retype because there won't be any `undefined` values after doMaintenance
|
|
180
|
-
return cacheMeta.cache;
|
|
181
|
-
};
|
|
182
|
-
const lowLevelSet = (cacheMeta, cacheKey, item) => {
|
|
183
|
-
upgradeCacheMeta(cacheMeta);
|
|
184
|
-
const { options: { maxCacheSize }, keyList, keyInfo, } = cacheMeta;
|
|
185
|
-
const now = dateNow();
|
|
186
|
-
const isNew = !keyInfo[cacheKey];
|
|
187
|
-
if (cacheMeta.cache[cacheKey] !== item) {
|
|
188
|
-
// The cache itself is immutable (but the rest of cacheMeta is not)
|
|
189
|
-
cacheMeta.cache = {
|
|
190
|
-
...cacheMeta.cache,
|
|
191
|
-
[cacheKey]: item,
|
|
192
|
-
};
|
|
193
|
-
}
|
|
194
|
-
// We've now set or updated it. Regardless of whether it's new, bump its set time
|
|
195
|
-
// @TODO: expireTime override
|
|
196
|
-
keyInfo[cacheKey] = [now, 0];
|
|
197
|
-
if (isNew) {
|
|
198
|
-
// It's a new key: grow the cache, then shrink it if we can
|
|
199
|
-
keyList.push(cacheKey);
|
|
200
|
-
cacheMeta.opsLeft--;
|
|
201
|
-
if (cacheMeta.opsLeft <= 0) {
|
|
202
|
-
// Time for an oil change
|
|
203
|
-
lowLevelDoMaintenance(cacheMeta);
|
|
204
|
-
}
|
|
205
|
-
if (maxCacheSize && cacheMeta.keyList.length > maxCacheSize) {
|
|
206
|
-
// We're still over the limit: drop at least one item
|
|
207
|
-
_removeItemsToMakeRoom(cacheMeta, now);
|
|
208
|
-
}
|
|
209
|
-
}
|
|
210
|
-
if (_cacheKeyHasExpired(cacheMeta, keyList[0], now)) {
|
|
211
|
-
// While we're here, if we need to expire the head of the queue then drop it
|
|
212
|
-
_removeFromIndex(cacheMeta, 0, now);
|
|
213
|
-
}
|
|
214
|
-
return cacheMeta;
|
|
215
|
-
};
|
|
216
|
-
const lowLevelRemove = (cacheMeta, cacheKey) => {
|
|
217
|
-
upgradeCacheMeta(cacheMeta);
|
|
218
|
-
const { cache, keyInfo } = cacheMeta;
|
|
219
|
-
if (keyInfo[cacheKey]) {
|
|
220
|
-
if (cache[cacheKey] !== undefined) {
|
|
221
|
-
cacheMeta.cache = {
|
|
222
|
-
...cache,
|
|
223
|
-
[cacheKey]: undefined,
|
|
224
|
-
};
|
|
225
|
-
}
|
|
226
|
-
keyInfo[cacheKey] = undefined;
|
|
227
|
-
}
|
|
228
|
-
return cacheMeta;
|
|
229
|
-
};
|
|
230
|
-
const lowLevelReset = (cacheMeta) => {
|
|
231
|
-
upgradeCacheMeta(cacheMeta);
|
|
232
|
-
return objectAssign(cacheMeta, {
|
|
233
|
-
cache: {},
|
|
234
|
-
keyList: [],
|
|
235
|
-
keyInfo: objectCreate(null),
|
|
236
|
-
opsLeft: cacheMeta.options.opLimit,
|
|
237
|
-
});
|
|
238
|
-
};
|
|
239
|
-
export { isCacheMeta, upgradeCacheMeta, lowLevelInit, lowLevelGetOne, lowLevelGetAll, lowLevelHas, lowLevelSet, lowLevelRemove, lowLevelReset, lowLevelDoMaintenance, lowLevelSetOptions, };
|
|
240
|
-
//# sourceMappingURL=lowLevelFunctions.js.map
|
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"lowLevelFunctions.js","sourceRoot":"","sources":["../../../src/core/lowLevelFunctions.ts"],"names":[],"mappings":"A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,IAAI,OAAO,CAAC,QAAQ,CAAC,EAAE,CAAC;QACtB,IAAI,KAAK,CAAC,QAAQ,CAAC,KAAK,SAAS,EAAE,CAAC;YAClC,SAAS,CAAC,KAAK,GAAG;gBAChB,GAAG,KAAK;gBACR,CAAC,QAAQ,CAAC,EAAE,SAAS;aACtB,CAAC;QACJ,CAAC;QACD,OAAO,CAAC,QAAQ,CAAC,GAAG,SAAS,CAAC;IAChC,CAAC;IAED,OAAO,SAAS,CAAC;AACnB,CAAC,CAAC;AAEF,MAAM,aAAa,GAAG,CACpB,SAAqC,EACT,EAAE;IAC9B,gBAAgB,CAAC,SAAS,CAAC,CAAC;IAC5B,OAAO,YAAY,CAAC,SAAS,EAAE;QAC7B,KAAK,EAAE,EAAE;QACT,OAAO,EAAE,EAAE;QACX,OAAO,EAAE,YAAY,CAAC,IAAI,CAAC;QAC3B,OAAO,EAAE,SAAS,CAAC,OAAO,CAAC,OAAO;KACnC,CAAC,CAAC;AACL,CAAC,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"}
|
package/dist/esm/types.d.ts
DELETED
|
@@ -1,58 +0,0 @@
|
|
|
1
|
-
export type DefaultItemType = any;
|
|
2
|
-
export interface LimitedCacheOptionsFull {
|
|
3
|
-
/** Items will be removed to keep the cache within the maxCacheSize limit */
|
|
4
|
-
maxCacheSize: number;
|
|
5
|
-
/** Items will be removed and never returned if they were set more than maxCacheTime milliseconds ago */
|
|
6
|
-
maxCacheTime: number;
|
|
7
|
-
/** (dev only) A warning will be emitted if an item rotates out of the cache before this many milliseconds have passed, to indicate the size is too small */
|
|
8
|
-
warnIfItemPurgedBeforeTime: number;
|
|
9
|
-
/** (private) Internal cleanup of old keys will be performed after this many operations */
|
|
10
|
-
opLimit: number;
|
|
11
|
-
/** (private) Internal optimization to adjust how much searching will be done to find expired items, to avoid being O(n) */
|
|
12
|
-
scanLimit: number;
|
|
13
|
-
}
|
|
14
|
-
export type LimitedCacheOptions = Partial<LimitedCacheOptionsFull> | null;
|
|
15
|
-
export type LimitedCacheOptionsReadonly = Readonly<LimitedCacheOptionsFull>;
|
|
16
|
-
export interface LimitedCacheInstance<ItemType = DefaultItemType> {
|
|
17
|
-
/** Return the requested item, if it has not expired */
|
|
18
|
-
get: (cacheKey: string) => ItemType | undefined;
|
|
19
|
-
/** Return all non-expired items */
|
|
20
|
-
getAll: () => Record<string, ItemType>;
|
|
21
|
-
/** Indicate whether or not the requested item is present and has not expired */
|
|
22
|
-
has: (cacheKey: string) => boolean;
|
|
23
|
-
/** Add the item to the cache, or update its timestamp if it already exists */
|
|
24
|
-
set: (cacheKey: string, item: ItemType) => ItemType;
|
|
25
|
-
/** Remove the requested item from the cache, if necessary */
|
|
26
|
-
remove: (cacheKey: string) => true;
|
|
27
|
-
/** Remove all items and all timestamps from the cache */
|
|
28
|
-
reset: () => LimitedCacheMeta<ItemType>;
|
|
29
|
-
/** Return a serializable representation of the cache internals, suitable for long-term storage */
|
|
30
|
-
getCacheMeta: () => LimitedCacheMeta<ItemType>;
|
|
31
|
-
/** Return the cache's current values for all options */
|
|
32
|
-
getOptions: () => LimitedCacheOptionsFull;
|
|
33
|
-
/** Update one or more of the cache's options */
|
|
34
|
-
setOptions: (newOptions: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
|
|
35
|
-
/** Reduces cache size by cleaning up old keys and expired items */
|
|
36
|
-
doMaintenance: () => LimitedCacheMeta<ItemType>;
|
|
37
|
-
}
|
|
38
|
-
export interface LimitedCacheObjectInstance<ItemType = DefaultItemType> {
|
|
39
|
-
[key: string]: ItemType;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A serializable representation of the cache internals, suitable for long-term storage
|
|
43
|
-
*/
|
|
44
|
-
export interface LimitedCacheMeta<ItemType = DefaultItemType> {
|
|
45
|
-
/** Schema version: old versions will be upgraded if possible, or a warning will be emitted if not */
|
|
46
|
-
limitedCacheMetaVersion: number;
|
|
47
|
-
/** Options to control cache size, time, and behavior */
|
|
48
|
-
options: LimitedCacheOptionsReadonly;
|
|
49
|
-
/** The values in the cache, stored by key. Will include old keys not yet garbage collected */
|
|
50
|
-
cache: Record<string, ItemType | undefined>;
|
|
51
|
-
/** List of keys that have been set, in chronological order. Used to find cache items most likely to be expired */
|
|
52
|
-
keyList: Array<string>;
|
|
53
|
-
/** The [setTime, expirationTime] for each key that has been set. Removed on unset. */
|
|
54
|
-
keyInfo: Record<string, [number, number] | undefined>;
|
|
55
|
-
/** Number of operations remaining until internal cleanup of old keys is performed. Based on options.opLimit */
|
|
56
|
-
opsLeft: number;
|
|
57
|
-
}
|
|
58
|
-
//# sourceMappingURL=types.d.ts.map
|
package/dist/esm/types.d.ts.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.d.ts","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":"AAIA,MAAM,MAAM,eAAe,GAAG,GAAG,CAAC;AAElC,MAAM,WAAW,uBAAuB;IACtC,4EAA4E;IAC5E,YAAY,EAAE,MAAM,CAAC;IACrB,wGAAwG;IACxG,YAAY,EAAE,MAAM,CAAC;IAErB,4JAA4J;IAC5J,0BAA0B,EAAE,MAAM,CAAC;IACnC,0FAA0F;IAC1F,OAAO,EAAE,MAAM,CAAC;IAChB,2HAA2H;IAC3H,SAAS,EAAE,MAAM,CAAC;CACnB;AAED,MAAM,MAAM,mBAAmB,GAAG,OAAO,CAAC,uBAAuB,CAAC,GAAG,IAAI,CAAC;AAC1E,MAAM,MAAM,2BAA2B,GAAG,QAAQ,CAAC,uBAAuB,CAAC,CAAC;AAE5E,MAAM,WAAW,oBAAoB,CAAC,QAAQ,GAAG,eAAe;IAC9D,uDAAuD;IACvD,GAAG,EAAE,CAAC,QAAQ,EAAE,MAAM,KAAK,QAAQ,GAAG,SAAS,CAAC;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AA+G;IAC/G,OAAO,EAAE,MAAM,CAAC;CACjB"}
|
package/dist/esm/types.js
DELETED
package/dist/esm/types.js.map
DELETED
|
@@ -1 +0,0 @@
|
|
|
1
|
-
{"version":3,"file":"types.js","sourceRoot":"","sources":["../../src/types.ts"],"names":[],"mappings":""}
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types.js';
|
|
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
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptionsReadonly } from '../types.js';
|
|
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
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const limitedCacheUtil: {
|
|
2
|
-
init: <ItemType = any>(optionsOrCacheMeta?: import("../types.js").LimitedCacheOptions | import("../types.js").LimitedCacheMeta<ItemType> | undefined) => import("../types.js").LimitedCacheMeta<ItemType>;
|
|
3
|
-
get: <ItemType_1 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
|
|
4
|
-
getAll: <ItemType_2 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
|
|
5
|
-
has: <ItemType_3 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
|
|
6
|
-
set: <ItemType_4 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("../types.js").LimitedCacheMeta<ItemType_4>;
|
|
7
|
-
remove: <ItemType_5 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("../types.js").LimitedCacheMeta<ItemType_5>;
|
|
8
|
-
reset: <ItemType_6 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_6>) => import("../types.js").LimitedCacheMeta<ItemType_6>;
|
|
9
|
-
doMaintenance: <ItemType_7 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_7>) => import("../types.js").LimitedCacheMeta<ItemType_7>;
|
|
10
|
-
setOptions: <ItemType_8 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_8>, options: import("../types.js").LimitedCacheOptions) => Readonly<import("../types.js").LimitedCacheOptionsFull>;
|
|
11
|
-
};
|
|
12
|
-
export { limitedCacheUtil };
|
|
13
|
-
//# sourceMappingURL=limitedCacheUtil.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types.js';
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './core/defaultOptions.js';
|
|
2
|
-
export * from './core/LimitedCache.js';
|
|
3
|
-
export * from './core/LimitedCacheObject.js';
|
|
4
|
-
export * from './core/limitedCacheUtil.js';
|
|
5
|
-
export * from './core/lowLevelFunctions.js';
|
|
6
|
-
export * from './types.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export type DefaultItemType = any;
|
|
2
|
-
export interface LimitedCacheOptionsFull {
|
|
3
|
-
/** Items will be removed to keep the cache within the maxCacheSize limit */
|
|
4
|
-
maxCacheSize: number;
|
|
5
|
-
/** Items will be removed and never returned if they were set more than maxCacheTime milliseconds ago */
|
|
6
|
-
maxCacheTime: number;
|
|
7
|
-
/** (dev only) A warning will be emitted if an item rotates out of the cache before this many milliseconds have passed, to indicate the size is too small */
|
|
8
|
-
warnIfItemPurgedBeforeTime: number;
|
|
9
|
-
/** (private) Internal cleanup of old keys will be performed after this many operations */
|
|
10
|
-
opLimit: number;
|
|
11
|
-
/** (private) Internal optimization to adjust how much searching will be done to find expired items, to avoid being O(n) */
|
|
12
|
-
scanLimit: number;
|
|
13
|
-
}
|
|
14
|
-
export type LimitedCacheOptions = Partial<LimitedCacheOptionsFull> | null;
|
|
15
|
-
export type LimitedCacheOptionsReadonly = Readonly<LimitedCacheOptionsFull>;
|
|
16
|
-
export interface LimitedCacheInstance<ItemType = DefaultItemType> {
|
|
17
|
-
/** Return the requested item, if it has not expired */
|
|
18
|
-
get: (cacheKey: string) => ItemType | undefined;
|
|
19
|
-
/** Return all non-expired items */
|
|
20
|
-
getAll: () => Record<string, ItemType>;
|
|
21
|
-
/** Indicate whether or not the requested item is present and has not expired */
|
|
22
|
-
has: (cacheKey: string) => boolean;
|
|
23
|
-
/** Add the item to the cache, or update its timestamp if it already exists */
|
|
24
|
-
set: (cacheKey: string, item: ItemType) => ItemType;
|
|
25
|
-
/** Remove the requested item from the cache, if necessary */
|
|
26
|
-
remove: (cacheKey: string) => true;
|
|
27
|
-
/** Remove all items and all timestamps from the cache */
|
|
28
|
-
reset: () => LimitedCacheMeta<ItemType>;
|
|
29
|
-
/** Return a serializable representation of the cache internals, suitable for long-term storage */
|
|
30
|
-
getCacheMeta: () => LimitedCacheMeta<ItemType>;
|
|
31
|
-
/** Return the cache's current values for all options */
|
|
32
|
-
getOptions: () => LimitedCacheOptionsFull;
|
|
33
|
-
/** Update one or more of the cache's options */
|
|
34
|
-
setOptions: (newOptions: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
|
|
35
|
-
/** Reduces cache size by cleaning up old keys and expired items */
|
|
36
|
-
doMaintenance: () => LimitedCacheMeta<ItemType>;
|
|
37
|
-
}
|
|
38
|
-
export interface LimitedCacheObjectInstance<ItemType = DefaultItemType> {
|
|
39
|
-
[key: string]: ItemType;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A serializable representation of the cache internals, suitable for long-term storage
|
|
43
|
-
*/
|
|
44
|
-
export interface LimitedCacheMeta<ItemType = DefaultItemType> {
|
|
45
|
-
/** Schema version: old versions will be upgraded if possible, or a warning will be emitted if not */
|
|
46
|
-
limitedCacheMetaVersion: number;
|
|
47
|
-
/** Options to control cache size, time, and behavior */
|
|
48
|
-
options: LimitedCacheOptionsReadonly;
|
|
49
|
-
/** The values in the cache, stored by key. Will include old keys not yet garbage collected */
|
|
50
|
-
cache: Record<string, ItemType | undefined>;
|
|
51
|
-
/** List of keys that have been set, in chronological order. Used to find cache items most likely to be expired */
|
|
52
|
-
keyList: Array<string>;
|
|
53
|
-
/** The [setTime, expirationTime] for each key that has been set. Removed on unset. */
|
|
54
|
-
keyInfo: Record<string, [
|
|
55
|
-
number,
|
|
56
|
-
number
|
|
57
|
-
] | undefined>;
|
|
58
|
-
/** Number of operations remaining until internal cleanup of old keys is performed. Based on options.opLimit */
|
|
59
|
-
opsLeft: number;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types.js';
|
|
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
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|
|
@@ -1,6 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptionsReadonly } from '../types.js';
|
|
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
|
|
@@ -1,13 +0,0 @@
|
|
|
1
|
-
declare const limitedCacheUtil: {
|
|
2
|
-
init: <ItemType = any>(optionsOrCacheMeta?: import("../types.js").LimitedCacheOptions | import("../types.js").LimitedCacheMeta<ItemType> | undefined) => import("../types.js").LimitedCacheMeta<ItemType>;
|
|
3
|
-
get: <ItemType_1 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_1>, cacheKey: string) => ItemType_1 | undefined;
|
|
4
|
-
getAll: <ItemType_2 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_2>) => Record<string, ItemType_2>;
|
|
5
|
-
has: <ItemType_3 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_3>, cacheKey: string) => boolean;
|
|
6
|
-
set: <ItemType_4 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_4>, cacheKey: string, item: ItemType_4) => import("../types.js").LimitedCacheMeta<ItemType_4>;
|
|
7
|
-
remove: <ItemType_5 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_5>, cacheKey: string) => import("../types.js").LimitedCacheMeta<ItemType_5>;
|
|
8
|
-
reset: <ItemType_6 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_6>) => import("../types.js").LimitedCacheMeta<ItemType_6>;
|
|
9
|
-
doMaintenance: <ItemType_7 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_7>) => import("../types.js").LimitedCacheMeta<ItemType_7>;
|
|
10
|
-
setOptions: <ItemType_8 = any>(cacheMeta: import("../types.js").LimitedCacheMeta<ItemType_8>, options: import("../types.js").LimitedCacheOptions) => Readonly<import("../types.js").LimitedCacheOptionsFull>;
|
|
11
|
-
};
|
|
12
|
-
export { limitedCacheUtil };
|
|
13
|
-
//# sourceMappingURL=limitedCacheUtil.d.ts.map
|
|
@@ -1,14 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptions, LimitedCacheOptionsReadonly, LimitedCacheMeta } from '../types.js';
|
|
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
|
|
@@ -1,7 +0,0 @@
|
|
|
1
|
-
export * from './core/defaultOptions.js';
|
|
2
|
-
export * from './core/LimitedCache.js';
|
|
3
|
-
export * from './core/LimitedCacheObject.js';
|
|
4
|
-
export * from './core/limitedCacheUtil.js';
|
|
5
|
-
export * from './core/lowLevelFunctions.js';
|
|
6
|
-
export * from './types.js';
|
|
7
|
-
//# sourceMappingURL=index.d.ts.map
|
|
@@ -1,61 +0,0 @@
|
|
|
1
|
-
export type DefaultItemType = any;
|
|
2
|
-
export interface LimitedCacheOptionsFull {
|
|
3
|
-
/** Items will be removed to keep the cache within the maxCacheSize limit */
|
|
4
|
-
maxCacheSize: number;
|
|
5
|
-
/** Items will be removed and never returned if they were set more than maxCacheTime milliseconds ago */
|
|
6
|
-
maxCacheTime: number;
|
|
7
|
-
/** (dev only) A warning will be emitted if an item rotates out of the cache before this many milliseconds have passed, to indicate the size is too small */
|
|
8
|
-
warnIfItemPurgedBeforeTime: number;
|
|
9
|
-
/** (private) Internal cleanup of old keys will be performed after this many operations */
|
|
10
|
-
opLimit: number;
|
|
11
|
-
/** (private) Internal optimization to adjust how much searching will be done to find expired items, to avoid being O(n) */
|
|
12
|
-
scanLimit: number;
|
|
13
|
-
}
|
|
14
|
-
export type LimitedCacheOptions = Partial<LimitedCacheOptionsFull> | null;
|
|
15
|
-
export type LimitedCacheOptionsReadonly = Readonly<LimitedCacheOptionsFull>;
|
|
16
|
-
export interface LimitedCacheInstance<ItemType = DefaultItemType> {
|
|
17
|
-
/** Return the requested item, if it has not expired */
|
|
18
|
-
get: (cacheKey: string) => ItemType | undefined;
|
|
19
|
-
/** Return all non-expired items */
|
|
20
|
-
getAll: () => Record<string, ItemType>;
|
|
21
|
-
/** Indicate whether or not the requested item is present and has not expired */
|
|
22
|
-
has: (cacheKey: string) => boolean;
|
|
23
|
-
/** Add the item to the cache, or update its timestamp if it already exists */
|
|
24
|
-
set: (cacheKey: string, item: ItemType) => ItemType;
|
|
25
|
-
/** Remove the requested item from the cache, if necessary */
|
|
26
|
-
remove: (cacheKey: string) => true;
|
|
27
|
-
/** Remove all items and all timestamps from the cache */
|
|
28
|
-
reset: () => LimitedCacheMeta<ItemType>;
|
|
29
|
-
/** Return a serializable representation of the cache internals, suitable for long-term storage */
|
|
30
|
-
getCacheMeta: () => LimitedCacheMeta<ItemType>;
|
|
31
|
-
/** Return the cache's current values for all options */
|
|
32
|
-
getOptions: () => LimitedCacheOptionsFull;
|
|
33
|
-
/** Update one or more of the cache's options */
|
|
34
|
-
setOptions: (newOptions: LimitedCacheOptions) => LimitedCacheOptionsReadonly;
|
|
35
|
-
/** Reduces cache size by cleaning up old keys and expired items */
|
|
36
|
-
doMaintenance: () => LimitedCacheMeta<ItemType>;
|
|
37
|
-
}
|
|
38
|
-
export interface LimitedCacheObjectInstance<ItemType = DefaultItemType> {
|
|
39
|
-
[key: string]: ItemType;
|
|
40
|
-
}
|
|
41
|
-
/**
|
|
42
|
-
* A serializable representation of the cache internals, suitable for long-term storage
|
|
43
|
-
*/
|
|
44
|
-
export interface LimitedCacheMeta<ItemType = DefaultItemType> {
|
|
45
|
-
/** Schema version: old versions will be upgraded if possible, or a warning will be emitted if not */
|
|
46
|
-
limitedCacheMetaVersion: number;
|
|
47
|
-
/** Options to control cache size, time, and behavior */
|
|
48
|
-
options: LimitedCacheOptionsReadonly;
|
|
49
|
-
/** The values in the cache, stored by key. Will include old keys not yet garbage collected */
|
|
50
|
-
cache: Record<string, ItemType | undefined>;
|
|
51
|
-
/** List of keys that have been set, in chronological order. Used to find cache items most likely to be expired */
|
|
52
|
-
keyList: Array<string>;
|
|
53
|
-
/** The [setTime, expirationTime] for each key that has been set. Removed on unset. */
|
|
54
|
-
keyInfo: Record<string, [
|
|
55
|
-
number,
|
|
56
|
-
number
|
|
57
|
-
] | undefined>;
|
|
58
|
-
/** Number of operations remaining until internal cleanup of old keys is performed. Based on options.opLimit */
|
|
59
|
-
opsLeft: number;
|
|
60
|
-
}
|
|
61
|
-
//# sourceMappingURL=types.d.ts.map
|
|
@@ -1,5 +0,0 @@
|
|
|
1
|
-
import { LimitedCacheOptions, LimitedCacheObjectInstance, LimitedCacheMeta } from '../types.js';
|
|
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
|
|
@@ -1,12 +0,0 @@
|
|
|
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
|