@nhan2804/nestjs-cacheable
Version:
@nestjs/cacheable is a flexible caching library for NestJS that leverages Redis for efficient and scalable storage. With support for function-level caching through easy-to-use decorators, it allows developers to seamlessly enhance performance while mainta
27 lines (26 loc) • 824 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.setCacheConfiguration = exports.getCacheManager = exports.setCacheManager = exports.cacheConfigOption = exports.cache = void 0;
exports.cacheConfigOption = {
ttl: 1000 * 60,
};
const setCacheManager = (c) => {
exports.cache = c;
};
exports.setCacheManager = setCacheManager;
const getCacheManager = () => {
return exports.cache;
};
exports.getCacheManager = getCacheManager;
const setCacheConfiguration = (c) => {
if (c.refreshThreshold) {
exports.cacheConfigOption.refreshThreshold = c.refreshThreshold;
}
if (c.ttl) {
exports.cacheConfigOption.ttl = c.ttl;
}
if (c.isDev) {
exports.cacheConfigOption.isDev = c.isDev;
}
};
exports.setCacheConfiguration = setCacheConfiguration;