cache-manager-ioredis-yet
Advanced tools
Comparing version
@@ -52,4 +52,4 @@ "use strict"; | ||
const t = ttl === undefined ? options === null || options === void 0 ? void 0 : options.ttl : ttl; | ||
if (t) | ||
yield redisCache.setex(key, Math.trunc(t / 1000), getVal(value)); | ||
if (t !== undefined && t !== 0) | ||
yield redisCache.set(key, getVal(value), 'PX', t); | ||
else | ||
@@ -62,3 +62,3 @@ yield redisCache.set(key, getVal(value)); | ||
const t = ttl === undefined ? options === null || options === void 0 ? void 0 : options.ttl : ttl; | ||
if (t) { | ||
if (t !== undefined && t !== 0) { | ||
const multi = redisCache.multi(); | ||
@@ -68,3 +68,3 @@ for (const [key, value] of args) { | ||
throw new NoCacheableError(`"${getVal(value)}" is not a cacheable value`); | ||
multi.setex(key, Math.trunc(t / 1000), getVal(value)); | ||
multi.set(key, getVal(value), 'PX', t); | ||
} | ||
@@ -71,0 +71,0 @@ yield multi.exec(); |
@@ -14,3 +14,3 @@ { | ||
"description": "Redis store for node-cache-manager updated", | ||
"version": "1.1.0", | ||
"version": "1.2.0", | ||
"license": "MIT", | ||
@@ -30,24 +30,24 @@ "main": "dist/index.js", | ||
"dependencies": { | ||
"cache-manager": "^5.1.0", | ||
"ioredis": "^5.2.3" | ||
"cache-manager": "^5.2.2", | ||
"ioredis": "^5.3.2" | ||
}, | ||
"devDependencies": { | ||
"@commitlint/cli": "17.4.2", | ||
"@commitlint/config-conventional": "17.4.2", | ||
"@commitlint/cli": "17.6.5", | ||
"@commitlint/config-conventional": "17.6.5", | ||
"@release-it/conventional-changelog": "5.1.1", | ||
"@types/node": "18.11.18", | ||
"@typescript-eslint/eslint-plugin": "5.48.1", | ||
"@typescript-eslint/parser": "5.48.1", | ||
"@vitest/coverage-c8": "0.27.1", | ||
"c8": "7.12.0", | ||
"dotenv-cli": "6.0.0", | ||
"eslint": "8.31.0", | ||
"eslint-config-prettier": "8.6.0", | ||
"@types/node": "20.3.1", | ||
"@typescript-eslint/eslint-plugin": "5.59.11", | ||
"@typescript-eslint/parser": "5.59.11", | ||
"@vitest/coverage-v8": "0.32.0", | ||
"c8": "8.0.0", | ||
"dotenv-cli": "7.2.1", | ||
"eslint": "8.42.0", | ||
"eslint-config-prettier": "8.8.0", | ||
"eslint-plugin-prettier": "4.2.1", | ||
"husky": "8.0.3", | ||
"lint-staged": "13.1.0", | ||
"prettier": "2.8.2", | ||
"release-it": "15.6.0", | ||
"typescript": "4.9.4", | ||
"vitest": "0.27.1" | ||
"lint-staged": "13.2.2", | ||
"prettier": "2.8.8", | ||
"release-it": "15.11.0", | ||
"typescript": "5.1.3", | ||
"vitest": "0.32.0" | ||
}, | ||
@@ -54,0 +54,0 @@ "engines": { |
@@ -50,3 +50,4 @@ import Redis, { | ||
const t = ttl === undefined ? options?.ttl : ttl; | ||
if (t) await redisCache.setex(key, Math.trunc(t / 1000), getVal(value)); | ||
if (t !== undefined && t !== 0) | ||
await redisCache.set(key, getVal(value), 'PX', t); | ||
else await redisCache.set(key, getVal(value)); | ||
@@ -56,3 +57,3 @@ }, | ||
const t = ttl === undefined ? options?.ttl : ttl; | ||
if (t) { | ||
if (t !== undefined && t !== 0) { | ||
const multi = redisCache.multi(); | ||
@@ -64,3 +65,3 @@ for (const [key, value] of args) { | ||
); | ||
multi.setex(key, Math.trunc(t / 1000), getVal(value)); | ||
multi.set(key, getVal(value), 'PX', t); | ||
} | ||
@@ -67,0 +68,0 @@ await multi.exec(); |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
59453
2.05%604
0.17%Updated
Updated