Huge News!Announcing our $40M Series B led by Abstract Ventures.Learn More
Socket
Sign inDemoInstall
Socket

redis_mgr

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis_mgr - npm Package Compare versions

Comparing version 0.0.3 to 0.0.4

5

lib/RedisMgr.d.ts

@@ -5,6 +5,7 @@ import { RedisClient } from "redis";

private readonly host;
private readonly connectedCallback;
private readonly redisClient;
constructor(port: number, host: string);
constructor(port: number, host: string, onConnected?: Function);
private static onError;
private static onConnected;
private readonly onConnected;
get client(): RedisClient;

@@ -11,0 +12,0 @@ /**

12

lib/RedisMgr.js
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class RedisMgr {
constructor(port, host) {
constructor(port, host, onConnected = null) {
this.onConnected = () => {
console.log(`Redis_已经连接正常`);
this.connectedCallback && this.connectedCallback();
};
this.port = port;
this.host = host;
this.connectedCallback = onConnected;
const redis = require("redis");
this.redisClient = redis.createClient(this.port, this.host);
this.redisClient.on("connect", RedisMgr.onConnected.bind(RedisMgr));
this.redisClient.on("connect", this.onConnected);
this.redisClient.on("error", RedisMgr.onError.bind(RedisMgr));

@@ -15,5 +20,2 @@ }

}
static onConnected(data) {
console.log(`\n------Redis------已经连接:${undefined === data ? "正常" : data.toString()}\n`);
}
get client() {

@@ -20,0 +22,0 @@ return this.redisClient;

@@ -6,8 +6,9 @@ import { RedisSubscribeHandler } from "./RedisSubscribeHandler";

private readonly redisClient;
private readonly connectedCallback;
private arr_channel;
constructor(port: number, host: string);
constructor(port: number, host: string, onConnected?: Function);
private init;
subscribe(channel: string, handler: RedisSubscribeHandler): void;
private static onError;
private static onConnected;
private readonly onConnected;
}
"use strict";
Object.defineProperty(exports, "__esModule", { value: true });
class RedisSubscriber {
constructor(port, host) {
constructor(port, host, onConnected = null) {
this.arr_channel = new Map();
this.onConnected = () => {
console.log("Redis_消息订阅客户端_已经连接");
this.connectedCallback && this.connectedCallback();
};
this.port = port;
this.host = host;
this.connectedCallback = onConnected;
const redis = require("redis");

@@ -13,3 +18,3 @@ this.redisClient = redis.createClient(this.port, this.host);

init() {
this.redisClient.on("connect", RedisSubscriber.onConnected.bind(RedisSubscriber));
this.redisClient.on("connect", this.onConnected);
this.redisClient.on("error", RedisSubscriber.onError.bind(RedisSubscriber));

@@ -42,6 +47,3 @@ this.redisClient.on("subscribe", (channel, count) => {

}
static onConnected(data) {
console.log("Redis_消息订阅客户端_已经连接:" + data);
}
}
exports.RedisSubscriber = RedisSubscriber;
{
"name": "redis_mgr",
"version": "0.0.3",
"version": "0.0.4",
"private": false,

@@ -5,0 +5,0 @@ "scripts": {

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc