@naman_deep_singh/js-extensions 1.3.0 → 1.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/README.md
CHANGED
|
@@ -5,4 +5,12 @@ export interface PerformanceConfig {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function setPerformanceConfig(newConfig: Partial<PerformanceConfig>): void;
|
|
7
7
|
export declare function getPerformanceConfig(): PerformanceConfig;
|
|
8
|
+
export declare class LRUCache<K, V> {
|
|
9
|
+
private cache;
|
|
10
|
+
private maxSize;
|
|
11
|
+
constructor(maxSize?: number);
|
|
12
|
+
get(key: K): V | undefined;
|
|
13
|
+
set(key: K, value: V): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
8
16
|
export declare function withCache<T>(key: string, fn: () => T): T;
|
|
@@ -1,5 +1,6 @@
|
|
|
1
1
|
"use strict";
|
|
2
2
|
Object.defineProperty(exports, "__esModule", { value: true });
|
|
3
|
+
exports.LRUCache = void 0;
|
|
3
4
|
exports.setPerformanceConfig = setPerformanceConfig;
|
|
4
5
|
exports.getPerformanceConfig = getPerformanceConfig;
|
|
5
6
|
exports.withCache = withCache;
|
|
@@ -52,6 +53,7 @@ class LRUCache {
|
|
|
52
53
|
this.cache.clear();
|
|
53
54
|
}
|
|
54
55
|
}
|
|
56
|
+
exports.LRUCache = LRUCache;
|
|
55
57
|
let cache = null;
|
|
56
58
|
function getOrCreateCache() {
|
|
57
59
|
if (!cache) {
|
|
@@ -5,4 +5,12 @@ export interface PerformanceConfig {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function setPerformanceConfig(newConfig: Partial<PerformanceConfig>): void;
|
|
7
7
|
export declare function getPerformanceConfig(): PerformanceConfig;
|
|
8
|
+
export declare class LRUCache<K, V> {
|
|
9
|
+
private cache;
|
|
10
|
+
private maxSize;
|
|
11
|
+
constructor(maxSize?: number);
|
|
12
|
+
get(key: K): V | undefined;
|
|
13
|
+
set(key: K, value: V): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
8
16
|
export declare function withCache<T>(key: string, fn: () => T): T;
|
|
@@ -5,4 +5,12 @@ export interface PerformanceConfig {
|
|
|
5
5
|
}
|
|
6
6
|
export declare function setPerformanceConfig(newConfig: Partial<PerformanceConfig>): void;
|
|
7
7
|
export declare function getPerformanceConfig(): PerformanceConfig;
|
|
8
|
+
export declare class LRUCache<K, V> {
|
|
9
|
+
private cache;
|
|
10
|
+
private maxSize;
|
|
11
|
+
constructor(maxSize?: number);
|
|
12
|
+
get(key: K): V | undefined;
|
|
13
|
+
set(key: K, value: V): void;
|
|
14
|
+
clear(): void;
|
|
15
|
+
}
|
|
8
16
|
export declare function withCache<T>(key: string, fn: () => T): T;
|