cache-manager-redis-yet
Advanced tools
Comparing version 5.1.0 to 5.1.1
@@ -1,9 +0,12 @@ | ||
import { createClient, createCluster, } from 'redis'; | ||
import '@redis/client'; | ||
import '@redis/bloom'; | ||
import '@redis/graph'; | ||
import '@redis/json'; | ||
import '@redis/search'; | ||
import '@redis/time-series'; | ||
export class NoCacheableError { | ||
"use strict"; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.redisClusterInsStore = exports.redisClusterStore = exports.redisInsStore = exports.redisStore = exports.avoidNoCacheable = exports.NoCacheableError = void 0; | ||
const redis_1 = require("redis"); | ||
require("@redis/client"); | ||
require("@redis/bloom"); | ||
require("@redis/graph"); | ||
require("@redis/json"); | ||
require("@redis/search"); | ||
require("@redis/time-series"); | ||
class NoCacheableError { | ||
message; | ||
@@ -15,3 +18,4 @@ name = 'NoCacheableError'; | ||
} | ||
export const avoidNoCacheable = async (p) => { | ||
exports.NoCacheableError = NoCacheableError; | ||
const avoidNoCacheable = async (p) => { | ||
try { | ||
@@ -25,2 +29,3 @@ return await p; | ||
}; | ||
exports.avoidNoCacheable = avoidNoCacheable; | ||
const getVal = (value) => JSON.stringify(value) || '"undefined"'; | ||
@@ -87,11 +92,12 @@ const getFullKey = (originalKey, keyPrefix) => `${keyPrefix ? `${keyPrefix}:` : ''}${originalKey}`; | ||
// TODO: past instance as option | ||
export async function redisStore(options) { | ||
const redisCache = createClient(options); | ||
async function redisStore(options) { | ||
const redisCache = (0, redis_1.createClient)(options); | ||
await redisCache.connect(); | ||
return redisInsStore(redisCache, options); | ||
} | ||
exports.redisStore = redisStore; | ||
/** | ||
* redisCache should be connected | ||
*/ | ||
export function redisInsStore(redisCache, options) { | ||
function redisInsStore(redisCache, options) { | ||
const reset = async () => { | ||
@@ -103,8 +109,10 @@ await redisCache.flushDb(); | ||
} | ||
exports.redisInsStore = redisInsStore; | ||
// TODO: coverage | ||
export async function redisClusterStore(options) { | ||
const redisCache = createCluster(options); | ||
async function redisClusterStore(options) { | ||
const redisCache = (0, redis_1.createCluster)(options); | ||
await redisCache.connect(); | ||
return redisClusterInsStore(redisCache, options); | ||
} | ||
exports.redisClusterStore = redisClusterStore; | ||
// TODO: coverage | ||
@@ -114,3 +122,3 @@ /** | ||
*/ | ||
export function redisClusterInsStore(redisCache, options) { | ||
function redisClusterInsStore(redisCache, options) { | ||
const reset = async () => { | ||
@@ -133,2 +141,3 @@ await Promise.all(redisCache.getMasters().map(async (node) => { | ||
} | ||
exports.redisClusterInsStore = redisClusterInsStore; | ||
//# sourceMappingURL=index.js.map |
{ | ||
"name": "cache-manager-redis-yet", | ||
"description": "Redis store for node-cache-manager updated", | ||
"version": "5.1.0", | ||
"version": "5.1.1", | ||
"license": "MIT", | ||
@@ -6,0 +6,0 @@ "main": "dist/index.js", |
{ | ||
"compilerOptions": { | ||
"lib": ["ES2022"], | ||
"module": "ESNext", | ||
"module": "commonjs", | ||
"target": "ES2022", | ||
@@ -6,0 +6,0 @@ "strict": true, |
Sorry, the diff of this file is not supported yet
Sorry, the diff of this file is not supported yet
176911
12
894