Latest Threat Research:SANDWORM_MODE: Shai-Hulud-Style npm Worm Hijacks CI Workflows and Poisons AI Toolchains.Details
Socket
Book a DemoInstallSign in
Socket

cacheable

Package Overview
Dependencies
Maintainers
1
Versions
44
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cacheable - npm Package Compare versions

Comparing version
2.3.2
to
2.3.3
+4
-2
dist/index.cjs

@@ -902,4 +902,5 @@ "use strict";

async getOrSet(key, function_, options) {
const getOptions = options?.nonBlocking === void 0 ? void 0 : { nonBlocking: options.nonBlocking };
const cacheAdapter = {
get: async (key2) => this.get(key2),
get: async (key2) => this.get(key2, getOptions),
/* v8 ignore next -- @preserve */

@@ -921,3 +922,4 @@ has: async (key2) => this.has(key2),

cacheErrors: options?.cacheErrors,
throwErrors: options?.throwErrors
throwErrors: options?.throwErrors,
nonBlocking: options?.nonBlocking
};

@@ -924,0 +926,0 @@ return (0, import_utils.getOrSet)(key, function_, getOrSetOptions);

@@ -887,4 +887,5 @@ // src/index.ts

async getOrSet(key, function_, options) {
const getOptions = options?.nonBlocking === void 0 ? void 0 : { nonBlocking: options.nonBlocking };
const cacheAdapter = {
get: async (key2) => this.get(key2),
get: async (key2) => this.get(key2, getOptions),
/* v8 ignore next -- @preserve */

@@ -906,3 +907,4 @@ has: async (key2) => this.has(key2),

cacheErrors: options?.cacheErrors,
throwErrors: options?.throwErrors
throwErrors: options?.throwErrors,
nonBlocking: options?.nonBlocking
};

@@ -909,0 +911,0 @@ return getOrSet(key, function_, getOrSetOptions);

{
"name": "cacheable",
"version": "2.3.2",
"version": "2.3.3",
"description": "High Performance Layer 1 / Layer 2 Caching with Keyv Storage",

@@ -30,3 +30,2 @@ "type": "module",

"devDependencies": {
"@biomejs/biome": "^2.3.11",
"@faker-js/faker": "^10.2.0",

@@ -36,16 +35,14 @@ "@keyv/redis": "^5.1.5",

"@qified/redis": "^0.6.0",
"@types/node": "^25.0.8",
"@vitest/coverage-v8": "^4.0.17",
"@types/node": "^24.10.10",
"lru-cache": "^11.2.4",
"rimraf": "^6.1.2",
"tsup": "^8.5.1",
"typescript": "^5.9.3",
"vitest": "^4.0.17"
"typescript": "^5.9.3"
},
"dependencies": {
"hookified": "^1.15.0",
"keyv": "^5.5.5",
"keyv": "^5.6.0",
"qified": "^0.6.0",
"@cacheable/memory": "^2.0.7",
"@cacheable/utils": "^2.3.3"
"@cacheable/memory": "^2.0.8",
"@cacheable/utils": "^2.4.0"
},

@@ -52,0 +49,0 @@ "keywords": [

@@ -5,3 +5,3 @@ [<img align="center" src="https://cacheable.org/logo.svg" alt="Cacheable" />](https://github.com/jaredwray/cacheable)

[![codecov](https://codecov.io/gh/jaredwray/cacheable/graph/badge.svg?token=lWZ9OBQ7GM)](https://codecov.io/gh/jaredwray/cacheable)
[![codecov](https://codecov.io/gh/jaredwray/cacheable/branch/main/graph/badge.svg?token=lWZ9OBQ7GM)](https://codecov.io/gh/jaredwray/cacheable)
[![tests](https://github.com/jaredwray/cacheable/actions/workflows/tests.yml/badge.svg)](https://github.com/jaredwray/cacheable/actions/workflows/tests.yml)

@@ -797,5 +797,8 @@ [![npm](https://img.shields.io/npm/dm/cacheable.svg)](https://www.npmjs.com/package/cacheable)

throwErrors?: boolean;
nonBlocking?: boolean;
};
```
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.
Here is an example of how to use the `getOrSet` method:

@@ -802,0 +805,0 @@