@fjell/cache 4.7.2 → 4.7.5
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/dist/CacheMap.d.ts +18 -18
- package/dist/browser/AsyncIndexDBCacheMap.d.ts +18 -1
- package/dist/browser/IndexDBCacheMap.d.ts +41 -43
- package/dist/browser/LocalStorageCacheMap.d.ts +18 -18
- package/dist/browser/SessionStorageCacheMap.d.ts +18 -18
- package/dist/events/CacheEventEmitter.d.ts +1 -0
- package/dist/eviction/EvictionManager.d.ts +3 -3
- package/dist/eviction/EvictionStrategy.d.ts +13 -13
- package/dist/eviction/strategies/ARCEvictionStrategy.d.ts +4 -4
- package/dist/eviction/strategies/FIFOEvictionStrategy.d.ts +4 -4
- package/dist/eviction/strategies/LFUEvictionStrategy.d.ts +4 -4
- package/dist/eviction/strategies/LRUEvictionStrategy.d.ts +4 -4
- package/dist/eviction/strategies/MRUEvictionStrategy.d.ts +4 -4
- package/dist/eviction/strategies/RandomEvictionStrategy.d.ts +4 -4
- package/dist/eviction/strategies/TwoQueueEvictionStrategy.d.ts +4 -4
- package/dist/index.js +750 -607
- package/dist/index.js.map +4 -4
- package/dist/memory/EnhancedMemoryCacheMap.d.ts +18 -18
- package/dist/memory/MemoryCacheMap.d.ts +18 -18
- package/dist/ttl/TTLManager.d.ts +10 -10
- package/package.json +7 -7
|
@@ -20,13 +20,13 @@ export declare class EnhancedMemoryCacheMap<V extends Item<S, L1, L2, L3, L4, L5
|
|
|
20
20
|
[key: string]: V;
|
|
21
21
|
});
|
|
22
22
|
get(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<V | null>;
|
|
23
|
-
set(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, value: V): void
|
|
23
|
+
set(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, value: V): Promise<void>;
|
|
24
24
|
includesKey(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<boolean>;
|
|
25
|
-
delete(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): void
|
|
25
|
+
delete(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<void>;
|
|
26
26
|
private deleteInternal;
|
|
27
|
-
keys(): (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]
|
|
27
|
+
keys(): Promise<(ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]>;
|
|
28
28
|
values(): Promise<V[]>;
|
|
29
|
-
clear(): void
|
|
29
|
+
clear(): Promise<void>;
|
|
30
30
|
allIn(locations: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<V[]>;
|
|
31
31
|
contains(query: ItemQuery, locations: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<boolean>;
|
|
32
32
|
queryIn(query: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<V[]>;
|
|
@@ -44,12 +44,12 @@ export declare class EnhancedMemoryCacheMap<V extends Item<S, L1, L2, L3, L4, L5
|
|
|
44
44
|
items?: number;
|
|
45
45
|
};
|
|
46
46
|
};
|
|
47
|
-
setQueryResult(queryHash: string, itemKeys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): void
|
|
47
|
+
setQueryResult(queryHash: string, itemKeys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): Promise<void>;
|
|
48
48
|
getQueryResult(queryHash: string): Promise<(ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[] | null>;
|
|
49
|
-
hasQueryResult(queryHash: string): boolean
|
|
50
|
-
deleteQueryResult(queryHash: string): void
|
|
51
|
-
clearQueryResults(): void
|
|
52
|
-
invalidateItemKeys(keys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): void
|
|
49
|
+
hasQueryResult(queryHash: string): Promise<boolean>;
|
|
50
|
+
deleteQueryResult(queryHash: string): Promise<void>;
|
|
51
|
+
clearQueryResults(): Promise<void>;
|
|
52
|
+
invalidateItemKeys(keys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): Promise<void>;
|
|
53
53
|
private filterQueriesReferencingKeys;
|
|
54
54
|
private invalidateQueriesReferencingKeys;
|
|
55
55
|
invalidateLocation(locations: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<void>;
|
|
@@ -65,17 +65,17 @@ export declare class EnhancedMemoryCacheMap<V extends Item<S, L1, L2, L3, L4, L5
|
|
|
65
65
|
* Get total cache size including query results
|
|
66
66
|
*/
|
|
67
67
|
getTotalSizeBytes(): number;
|
|
68
|
-
getMetadata(key: string): CacheItemMetadata | null
|
|
69
|
-
setMetadata(key: string, metadata: CacheItemMetadata): void
|
|
70
|
-
deleteMetadata(_key: string): void
|
|
71
|
-
getAllMetadata(): Map<string, CacheItemMetadata
|
|
72
|
-
clearMetadata(): void
|
|
73
|
-
getCurrentSize(): {
|
|
68
|
+
getMetadata(key: string): Promise<CacheItemMetadata | null>;
|
|
69
|
+
setMetadata(key: string, metadata: CacheItemMetadata): Promise<void>;
|
|
70
|
+
deleteMetadata(_key: string): Promise<void>;
|
|
71
|
+
getAllMetadata(): Promise<Map<string, CacheItemMetadata>>;
|
|
72
|
+
clearMetadata(): Promise<void>;
|
|
73
|
+
getCurrentSize(): Promise<{
|
|
74
74
|
itemCount: number;
|
|
75
75
|
sizeBytes: number;
|
|
76
|
-
}
|
|
77
|
-
getSizeLimits(): {
|
|
76
|
+
}>;
|
|
77
|
+
getSizeLimits(): Promise<{
|
|
78
78
|
maxItems: number | null;
|
|
79
79
|
maxSizeBytes: number | null;
|
|
80
|
-
}
|
|
80
|
+
}>;
|
|
81
81
|
}
|
|
@@ -15,34 +15,34 @@ export declare class MemoryCacheMap<V extends Item<S, L1, L2, L3, L4, L5>, S ext
|
|
|
15
15
|
[key: string]: V;
|
|
16
16
|
});
|
|
17
17
|
get(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<V | null>;
|
|
18
|
-
set(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, value: V): void
|
|
18
|
+
set(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>, value: V): Promise<void>;
|
|
19
19
|
includesKey(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<boolean>;
|
|
20
|
-
delete(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): void
|
|
21
|
-
keys(): (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]
|
|
20
|
+
delete(key: ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>): Promise<void>;
|
|
21
|
+
keys(): Promise<(ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]>;
|
|
22
22
|
values(): Promise<V[]>;
|
|
23
|
-
clear(): void
|
|
23
|
+
clear(): Promise<void>;
|
|
24
24
|
allIn(locations: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<V[]>;
|
|
25
25
|
contains(query: ItemQuery, locations: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<boolean>;
|
|
26
26
|
queryIn(query: ItemQuery, locations?: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<V[]>;
|
|
27
27
|
clone(): Promise<MemoryCacheMap<V, S, L1, L2, L3, L4, L5>>;
|
|
28
|
-
setQueryResult(queryHash: string, itemKeys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): void
|
|
28
|
+
setQueryResult(queryHash: string, itemKeys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): Promise<void>;
|
|
29
29
|
getQueryResult(queryHash: string): Promise<(ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[] | null>;
|
|
30
|
-
hasQueryResult(queryHash: string): boolean
|
|
31
|
-
deleteQueryResult(queryHash: string): void
|
|
32
|
-
invalidateItemKeys(keys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): void
|
|
30
|
+
hasQueryResult(queryHash: string): Promise<boolean>;
|
|
31
|
+
deleteQueryResult(queryHash: string): Promise<void>;
|
|
32
|
+
invalidateItemKeys(keys: (ComKey<S, L1, L2, L3, L4, L5> | PriKey<S>)[]): Promise<void>;
|
|
33
33
|
invalidateLocation(locations: LocKeyArray<L1, L2, L3, L4, L5> | []): Promise<void>;
|
|
34
|
-
clearQueryResults(): void
|
|
35
|
-
getMetadata(key: string): CacheItemMetadata | null
|
|
36
|
-
setMetadata(key: string, metadata: CacheItemMetadata): void
|
|
37
|
-
deleteMetadata(key: string): void
|
|
38
|
-
getAllMetadata(): Map<string, CacheItemMetadata
|
|
39
|
-
clearMetadata(): void
|
|
40
|
-
getCurrentSize(): {
|
|
34
|
+
clearQueryResults(): Promise<void>;
|
|
35
|
+
getMetadata(key: string): Promise<CacheItemMetadata | null>;
|
|
36
|
+
setMetadata(key: string, metadata: CacheItemMetadata): Promise<void>;
|
|
37
|
+
deleteMetadata(key: string): Promise<void>;
|
|
38
|
+
getAllMetadata(): Promise<Map<string, CacheItemMetadata>>;
|
|
39
|
+
clearMetadata(): Promise<void>;
|
|
40
|
+
getCurrentSize(): Promise<{
|
|
41
41
|
itemCount: number;
|
|
42
42
|
sizeBytes: number;
|
|
43
|
-
}
|
|
44
|
-
getSizeLimits(): {
|
|
43
|
+
}>;
|
|
44
|
+
getSizeLimits(): Promise<{
|
|
45
45
|
maxItems: number | null;
|
|
46
46
|
maxSizeBytes: number | null;
|
|
47
|
-
}
|
|
47
|
+
}>;
|
|
48
48
|
}
|
package/dist/ttl/TTLManager.d.ts
CHANGED
|
@@ -44,47 +44,47 @@ export declare class TTLManager {
|
|
|
44
44
|
/**
|
|
45
45
|
* Set TTL metadata for an item when it's added
|
|
46
46
|
*/
|
|
47
|
-
onItemAdded(key: string, metadataProvider: CacheMapMetadataProvider, itemTTL?: number): void
|
|
47
|
+
onItemAdded(key: string, metadataProvider: CacheMapMetadataProvider, itemTTL?: number): Promise<void>;
|
|
48
48
|
/**
|
|
49
49
|
* Check if an item has expired
|
|
50
50
|
*/
|
|
51
|
-
isExpired(key: string, metadataProvider: CacheMapMetadataProvider): boolean
|
|
51
|
+
isExpired(key: string, metadataProvider: CacheMapMetadataProvider): Promise<boolean>;
|
|
52
52
|
/**
|
|
53
53
|
* Check if an item is valid (not expired) before returning it
|
|
54
54
|
* Returns true if item is valid, false if expired
|
|
55
55
|
*/
|
|
56
|
-
validateItem(key: string, metadataProvider: CacheMapMetadataProvider): boolean
|
|
56
|
+
validateItem(key: string, metadataProvider: CacheMapMetadataProvider): Promise<boolean>;
|
|
57
57
|
/**
|
|
58
58
|
* Get TTL information for an item
|
|
59
59
|
*/
|
|
60
|
-
getItemTTLInfo(key: string, metadataProvider: CacheMapMetadataProvider): {
|
|
60
|
+
getItemTTLInfo(key: string, metadataProvider: CacheMapMetadataProvider): Promise<{
|
|
61
61
|
hasTTL: boolean;
|
|
62
62
|
ttl?: number;
|
|
63
63
|
expiresAt?: number;
|
|
64
64
|
remainingTTL?: number;
|
|
65
65
|
isExpired: boolean;
|
|
66
|
-
}
|
|
66
|
+
}>;
|
|
67
67
|
/**
|
|
68
68
|
* Find all expired items
|
|
69
69
|
*/
|
|
70
|
-
findExpiredItems(metadataProvider: CacheMapMetadataProvider): string[]
|
|
70
|
+
findExpiredItems(metadataProvider: CacheMapMetadataProvider): Promise<string[]>;
|
|
71
71
|
/**
|
|
72
72
|
* Manually clean up expired items
|
|
73
73
|
* Returns the keys of items that were expired
|
|
74
74
|
*/
|
|
75
|
-
cleanupExpiredItems(metadataProvider: CacheMapMetadataProvider): string[]
|
|
75
|
+
cleanupExpiredItems(metadataProvider: CacheMapMetadataProvider): Promise<string[]>;
|
|
76
76
|
/**
|
|
77
77
|
* Get remaining TTL for an item in milliseconds
|
|
78
78
|
*/
|
|
79
|
-
getRemainingTTL(key: string, metadataProvider: CacheMapMetadataProvider): number | null
|
|
79
|
+
getRemainingTTL(key: string, metadataProvider: CacheMapMetadataProvider): Promise<number | null>;
|
|
80
80
|
/**
|
|
81
81
|
* Extend TTL for an item
|
|
82
82
|
*/
|
|
83
|
-
extendTTL(key: string, metadataProvider: CacheMapMetadataProvider, additionalTTL: number): boolean
|
|
83
|
+
extendTTL(key: string, metadataProvider: CacheMapMetadataProvider, additionalTTL: number): Promise<boolean>;
|
|
84
84
|
/**
|
|
85
85
|
* Reset TTL for an item (refresh expiration)
|
|
86
86
|
*/
|
|
87
|
-
refreshTTL(key: string, metadataProvider: CacheMapMetadataProvider, newTTL?: number): boolean
|
|
87
|
+
refreshTTL(key: string, metadataProvider: CacheMapMetadataProvider, newTTL?: number): Promise<boolean>;
|
|
88
88
|
/**
|
|
89
89
|
* Start automatic cleanup of expired items
|
|
90
90
|
*/
|
package/package.json
CHANGED
|
@@ -1,7 +1,7 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@fjell/cache",
|
|
3
3
|
"description": "Cache for Fjell",
|
|
4
|
-
"version": "4.7.
|
|
4
|
+
"version": "4.7.5",
|
|
5
5
|
"keywords": [
|
|
6
6
|
"cache",
|
|
7
7
|
"fjell"
|
|
@@ -31,18 +31,18 @@
|
|
|
31
31
|
"docs:test": "cd docs && npm run test"
|
|
32
32
|
},
|
|
33
33
|
"dependencies": {
|
|
34
|
-
"@fjell/client-api": "^4.4.
|
|
35
|
-
"@fjell/core": "^4.4.
|
|
36
|
-
"@fjell/http-api": "^4.4.
|
|
37
|
-
"@fjell/logging": "^4.4.
|
|
38
|
-
"@fjell/registry": "^4.4.
|
|
34
|
+
"@fjell/client-api": "^4.4.25",
|
|
35
|
+
"@fjell/core": "^4.4.35",
|
|
36
|
+
"@fjell/http-api": "^4.4.34",
|
|
37
|
+
"@fjell/logging": "^4.4.41",
|
|
38
|
+
"@fjell/registry": "^4.4.29",
|
|
39
39
|
"fast-safe-stringify": "^2.1.1",
|
|
40
40
|
"flatted": "^3.3.3"
|
|
41
41
|
},
|
|
42
42
|
"devDependencies": {
|
|
43
43
|
"@eslint/eslintrc": "^3.3.1",
|
|
44
44
|
"@eslint/js": "^9.33.0",
|
|
45
|
-
"@fjell/eslint-config": "^1.1.
|
|
45
|
+
"@fjell/eslint-config": "^1.1.20",
|
|
46
46
|
"@swc/core": "^1.13.3",
|
|
47
47
|
"@tsconfig/recommended": "^1.0.10",
|
|
48
48
|
"@types/multer": "^2.0.0",
|