UNPKG

layered-loader

Version:

Data loader with support for caching and fallback data sources

50 lines 1.79 kB
"use strict"; Object.defineProperty(exports, "__esModule", { value: true }); exports.RedisGroupNotificationPublisher = exports.DELETE_FROM_GROUP_COMMAND = exports.DELETE_GROUP_COMMAND = exports.CLEAR_COMMAND = void 0; const NotificationPublisher_1 = require("../notifications/NotificationPublisher"); exports.CLEAR_COMMAND = 'CLEAR'; exports.DELETE_GROUP_COMMAND = 'DELETE_GROUP'; exports.DELETE_FROM_GROUP_COMMAND = 'DELETE_FROM_GROUP'; class RedisGroupNotificationPublisher { channel; errorHandler; redis; serverUuid; constructor(redis, config) { this.redis = redis; this.channel = config.channel; this.serverUuid = config.serverUuid; this.errorHandler = config.errorHandler ?? NotificationPublisher_1.DEFAULT_NOTIFICATION_ERROR_HANDLER; } clear() { return this.redis.publish(this.channel, JSON.stringify({ actionId: exports.CLEAR_COMMAND, originUuid: this.serverUuid, })); } deleteFromGroup(key, group) { return this.redis.publish(this.channel, JSON.stringify({ actionId: exports.DELETE_FROM_GROUP_COMMAND, key, group, originUuid: this.serverUuid, })); } deleteGroup(group) { return this.redis.publish(this.channel, JSON.stringify({ actionId: exports.DELETE_GROUP_COMMAND, group, originUuid: this.serverUuid, })); } close() { return new Promise((resolve) => { void this.redis.quit((_err, result) => { return resolve(); }); }); } async subscribe() { } } exports.RedisGroupNotificationPublisher = RedisGroupNotificationPublisher; //# sourceMappingURL=RedisGroupNotificationPublisher.js.map