Closed
Description
Describe the bug
When the redis server cannot be connected, if keyv+@keyv/redis is used, no error will be thrown when the first call is get
. If the next call is set
, the process will strangely exit by itself.
However, if the first call is set
, or use @keyv/valkey
instead of @keyv/redis
, the problem does not exist.
How To Reproduce (best to provide workable code or tests!)
The sample code is as follows. My computer is not running redis server when executing it.
import { Keyv } from "keyv";
import KeyvRedis from "@keyv/redis";
import { createCache } from "cache-manager";
const cache = createCache({
stores: [
new Keyv({
store: new KeyvRedis("redis://user:[email protected]:6379"),
}),
],
});
async function main() {
console.log("1. ", await cache.get("foo"));
console.log("before call set");
await cache.set("foo", "bar");
console.log("after call set");
console.log("2. ", await cache.get("foo"));
}
main();
The output of this code is
1. null
before call set
The sample code is at https://github.com/muzea-demo/cache-manager-test, including the pnpm-lock.yaml.
My local environment is Windows 10 + node 22.14.0.