hypershield
Version:
Middleware suite for high-performance and resilient APIs
27 lines • 973 B
JavaScript
;
Object.defineProperty(exports, "__esModule", { value: true });
exports.CacheFactory = void 0;
const cacheService_1 = require("../../domains/cache/application/cacheService");
const cache_1 = require("../../core/config/cache");
class CacheFactory {
static createCacheService(config) {
if (!this.instance) {
const validatedConfig = (0, cache_1.validateCacheConfig)(config);
this.instance = new cacheService_1.CacheService(validatedConfig);
}
return this.instance;
}
static getInstance() {
if (!this.instance) {
throw new Error('Cache service not initialized. Call createCacheService first.');
}
return this.instance;
}
static clearInstance() {
var _a;
(_a = this.instance) === null || _a === void 0 ? void 0 : _a.clear();
this.instance = undefined;
}
}
exports.CacheFactory = CacheFactory;
//# sourceMappingURL=cacheFactory.js.map