@cacheable/utils 2.3.4 → 2.4.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
@@ -2,7 +2,7 @@
2
2
 
3
3
  > Cacheble Utils
4
4
 
5
- [![codecov](https://codecov.io/gh/jaredwray/cacheable/graph/badge.svg?token=lWZ9OBQ7GM)](https://codecov.io/gh/jaredwray/cacheable)
5
+ [![codecov](https://codecov.io/gh/jaredwray/cacheable/branch/main/graph/badge.svg?token=lWZ9OBQ7GM)](https://codecov.io/gh/jaredwray/cacheable)
6
6
  [![tests](https://github.com/jaredwray/cacheable/actions/workflows/tests.yml/badge.svg)](https://github.com/jaredwray/cacheable/actions/workflows/tests.yml)
7
7
  [![npm](https://img.shields.io/npm/dm/@cacheable/utils.svg)](https://www.npmjs.com/package/@cacheable/utils)
8
8
  [![npm](https://img.shields.io/npm/v/@cacheable/utils)](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.4",
3
+ "version": "2.4.1",
4
4
  "description": "Cacheable Utilities for Caching Libraries",
5
5
  "type": "module",
6
6
  "main": "./dist/index.js",
@@ -27,14 +27,10 @@
27
27
  "license": "MIT",
28
28
  "private": false,
29
29
  "dependencies": {
30
- "hashery": "^1.3.0",
30
+ "hashery": "^1.5.1",
31
31
  "keyv": "^5.6.0"
32
32
  },
33
33
  "devDependencies": {
34
- "@faker-js/faker": "^10.2.0",
35
- "@types/node": "^24.10.10",
36
- "lru-cache": "^11.2.4",
37
- "rimraf": "^6.1.2",
38
34
  "tsup": "^8.5.1",
39
35
  "typescript": "^5.9.3"
40
36
  },
@@ -52,7 +48,6 @@
52
48
  ],
53
49
  "scripts": {
54
50
  "build": "rimraf ./dist && tsup src/index.ts --format cjs,esm --dts --clean",
55
- "prepublish": "pnpm build",
56
51
  "lint": "biome check --write --error-on-warnings",
57
52
  "test": "pnpm lint && vitest run --coverage",
58
53
  "test:ci": "biome check --error-on-warnings && vitest run --coverage",