@nextastic/cache
Advanced tools
Comparing version 0.1.0 to 0.2.0
"use strict"; | ||
var __importDefault = (this && this.__importDefault) || function (mod) { | ||
return (mod && mod.__esModule) ? mod : { "default": mod }; | ||
}; | ||
Object.defineProperty(exports, "__esModule", { value: true }); | ||
exports.get = get; | ||
const redis_1 = require("@nextastic/redis"); | ||
const node_process_1 = __importDefault(require("node:process")); | ||
const driver = node_process_1.default.env.CACHE_DRIVER ?? 'redis'; | ||
async function get(key, defaultValue) { | ||
const redis = await (0, redis_1.createRedisClient)(); | ||
const value = await redis.get(key); | ||
return value ?? defaultValue; | ||
if (driver === 'redis') { | ||
const redis = await (0, redis_1.createRedisClient)(); | ||
const value = await redis.get(key); | ||
return value ?? defaultValue; | ||
} | ||
return defaultValue; | ||
} |
{ | ||
"name": "@nextastic/cache", | ||
"version": "0.1.0", | ||
"version": "0.2.0", | ||
"description": "Cache provider to store and retrieve data. ", | ||
@@ -5,0 +5,0 @@ "repository": { |
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
License Policy Violation
LicenseThis package is not allowed per your license policy. Review the package's license to ensure compliance.
Found 1 instance in 1 package
2659
47