@cacheable/utils 2.3.4 → 2.4.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/README.md +4 -1
- package/dist/index.d.cts +5 -0
- package/dist/index.d.ts +5 -0
- package/package.json +5 -6
package/README.md
CHANGED
|
@@ -2,7 +2,7 @@
|
|
|
2
2
|
|
|
3
3
|
> Cacheble Utils
|
|
4
4
|
|
|
5
|
-
[](https://codecov.io/gh/jaredwray/cacheable)
|
|
5
|
+
[](https://codecov.io/gh/jaredwray/cacheable)
|
|
6
6
|
[](https://github.com/jaredwray/cacheable/actions/workflows/tests.yml)
|
|
7
7
|
[](https://www.npmjs.com/package/@cacheable/utils)
|
|
8
8
|
[](https://www.npmjs.com/package/@cacheable/utils)
|
|
@@ -480,9 +480,12 @@ export type GetOrSetFunctionOptions = {
|
|
|
480
480
|
ttl?: number | string;
|
|
481
481
|
cacheErrors?: boolean;
|
|
482
482
|
throwErrors?: boolean;
|
|
483
|
+
nonBlocking?: boolean;
|
|
483
484
|
};
|
|
484
485
|
```
|
|
485
486
|
|
|
487
|
+
The `nonBlocking` option allows you to override the instance-level `nonBlocking` setting for the `get` call within `getOrSet`. When set to `false`, the `get` will block and wait for a response from the secondary store before deciding whether to call the provided function. When set to `true`, the primary store returns immediately and syncs from secondary in the background.
|
|
488
|
+
|
|
486
489
|
Here is an example of how to use the `getOrSet` method:
|
|
487
490
|
|
|
488
491
|
```javascript
|
package/dist/index.d.cts
CHANGED
|
@@ -152,6 +152,11 @@ type GetOrSetFunctionOptions = {
|
|
|
152
152
|
* - `"store"` - only throw errors that occur when getting/setting the cache
|
|
153
153
|
*/
|
|
154
154
|
throwErrors?: boolean | GetOrSetThrowErrorsContext;
|
|
155
|
+
/**
|
|
156
|
+
* If set, this will bypass the instances nonBlocking setting for the get call.
|
|
157
|
+
* @type {boolean}
|
|
158
|
+
*/
|
|
159
|
+
nonBlocking?: boolean;
|
|
155
160
|
};
|
|
156
161
|
type GetOrSetOptions = GetOrSetFunctionOptions & {
|
|
157
162
|
cacheId?: string;
|
package/dist/index.d.ts
CHANGED
|
@@ -152,6 +152,11 @@ type GetOrSetFunctionOptions = {
|
|
|
152
152
|
* - `"store"` - only throw errors that occur when getting/setting the cache
|
|
153
153
|
*/
|
|
154
154
|
throwErrors?: boolean | GetOrSetThrowErrorsContext;
|
|
155
|
+
/**
|
|
156
|
+
* If set, this will bypass the instances nonBlocking setting for the get call.
|
|
157
|
+
* @type {boolean}
|
|
158
|
+
*/
|
|
159
|
+
nonBlocking?: boolean;
|
|
155
160
|
};
|
|
156
161
|
type GetOrSetOptions = GetOrSetFunctionOptions & {
|
|
157
162
|
cacheId?: string;
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@cacheable/utils",
|
|
3
|
-
"version": "2.
|
|
3
|
+
"version": "2.4.0",
|
|
4
4
|
"description": "Cacheable Utilities for Caching Libraries",
|
|
5
5
|
"type": "module",
|
|
6
6
|
"main": "./dist/index.js",
|
|
@@ -27,14 +27,13 @@
|
|
|
27
27
|
"license": "MIT",
|
|
28
28
|
"private": false,
|
|
29
29
|
"dependencies": {
|
|
30
|
-
"hashery": "^1.
|
|
30
|
+
"hashery": "^1.5.0",
|
|
31
31
|
"keyv": "^5.6.0"
|
|
32
32
|
},
|
|
33
33
|
"devDependencies": {
|
|
34
|
-
"@faker-js/faker": "^10.
|
|
35
|
-
"@types/node": "^
|
|
36
|
-
"
|
|
37
|
-
"rimraf": "^6.1.2",
|
|
34
|
+
"@faker-js/faker": "^10.3.0",
|
|
35
|
+
"@types/node": "^25.3.0",
|
|
36
|
+
"rimraf": "^6.1.3",
|
|
38
37
|
"tsup": "^8.5.1",
|
|
39
38
|
"typescript": "^5.9.3"
|
|
40
39
|
},
|