@sebspark/promise-cache 1.2.4 → 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/dist/index.d.mts +10 -8
- package/dist/index.d.ts +10 -8
- package/package.json +1 -1
package/dist/index.d.mts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createClient, RedisClientOptions } from 'redis';
|
|
2
|
+
export { RedisClientOptions } from 'redis';
|
|
2
3
|
|
|
3
4
|
type GetType<T> = {
|
|
4
5
|
value: T;
|
|
@@ -33,6 +34,13 @@ declare const createPersistor: ({ redis, onError, onSuccess, }: {
|
|
|
33
34
|
}) => Persistor;
|
|
34
35
|
declare const clean: () => void;
|
|
35
36
|
|
|
37
|
+
type PromiseCacheOptions = {
|
|
38
|
+
ttlInSeconds?: number;
|
|
39
|
+
caseSensitive?: boolean;
|
|
40
|
+
redis?: RedisClientOptions;
|
|
41
|
+
onError?: () => void;
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
};
|
|
36
44
|
declare class PromiseCache<U> {
|
|
37
45
|
persistor: Persistor;
|
|
38
46
|
private readonly caseSensitive;
|
|
@@ -42,13 +50,7 @@ declare class PromiseCache<U> {
|
|
|
42
50
|
* @param ttlInSeconds Default cache TTL.
|
|
43
51
|
* @param caseSensitive Set to true if you want to differentiate between keys with different casing.
|
|
44
52
|
*/
|
|
45
|
-
constructor({ ttlInSeconds, caseSensitive, redis, onSuccess, onError, }:
|
|
46
|
-
ttlInSeconds?: number;
|
|
47
|
-
caseSensitive?: boolean;
|
|
48
|
-
redis?: RedisClientOptions;
|
|
49
|
-
onError?: () => void;
|
|
50
|
-
onSuccess?: () => void;
|
|
51
|
-
});
|
|
53
|
+
constructor({ ttlInSeconds, caseSensitive, redis, onSuccess, onError, }: PromiseCacheOptions);
|
|
52
54
|
/**
|
|
53
55
|
* Cache size.
|
|
54
56
|
* @returns The number of entries in the cache.
|
|
@@ -90,4 +92,4 @@ declare class LocalStorage {
|
|
|
90
92
|
}
|
|
91
93
|
declare const createLocalMemoryClient: () => LocalStorage;
|
|
92
94
|
|
|
93
|
-
export { LocalStorage, Persistor, PromiseCache, clean, createLocalMemoryClient, createPersistor };
|
|
95
|
+
export { LocalStorage, Persistor, PromiseCache, type PromiseCacheOptions, clean, createLocalMemoryClient, createPersistor };
|
package/dist/index.d.ts
CHANGED
|
@@ -1,4 +1,5 @@
|
|
|
1
1
|
import { createClient, RedisClientOptions } from 'redis';
|
|
2
|
+
export { RedisClientOptions } from 'redis';
|
|
2
3
|
|
|
3
4
|
type GetType<T> = {
|
|
4
5
|
value: T;
|
|
@@ -33,6 +34,13 @@ declare const createPersistor: ({ redis, onError, onSuccess, }: {
|
|
|
33
34
|
}) => Persistor;
|
|
34
35
|
declare const clean: () => void;
|
|
35
36
|
|
|
37
|
+
type PromiseCacheOptions = {
|
|
38
|
+
ttlInSeconds?: number;
|
|
39
|
+
caseSensitive?: boolean;
|
|
40
|
+
redis?: RedisClientOptions;
|
|
41
|
+
onError?: () => void;
|
|
42
|
+
onSuccess?: () => void;
|
|
43
|
+
};
|
|
36
44
|
declare class PromiseCache<U> {
|
|
37
45
|
persistor: Persistor;
|
|
38
46
|
private readonly caseSensitive;
|
|
@@ -42,13 +50,7 @@ declare class PromiseCache<U> {
|
|
|
42
50
|
* @param ttlInSeconds Default cache TTL.
|
|
43
51
|
* @param caseSensitive Set to true if you want to differentiate between keys with different casing.
|
|
44
52
|
*/
|
|
45
|
-
constructor({ ttlInSeconds, caseSensitive, redis, onSuccess, onError, }:
|
|
46
|
-
ttlInSeconds?: number;
|
|
47
|
-
caseSensitive?: boolean;
|
|
48
|
-
redis?: RedisClientOptions;
|
|
49
|
-
onError?: () => void;
|
|
50
|
-
onSuccess?: () => void;
|
|
51
|
-
});
|
|
53
|
+
constructor({ ttlInSeconds, caseSensitive, redis, onSuccess, onError, }: PromiseCacheOptions);
|
|
52
54
|
/**
|
|
53
55
|
* Cache size.
|
|
54
56
|
* @returns The number of entries in the cache.
|
|
@@ -90,4 +92,4 @@ declare class LocalStorage {
|
|
|
90
92
|
}
|
|
91
93
|
declare const createLocalMemoryClient: () => LocalStorage;
|
|
92
94
|
|
|
93
|
-
export { LocalStorage, Persistor, PromiseCache, clean, createLocalMemoryClient, createPersistor };
|
|
95
|
+
export { LocalStorage, Persistor, PromiseCache, type PromiseCacheOptions, clean, createLocalMemoryClient, createPersistor };
|