@hastehaul/common 1.0.18 → 1.0.19

Sign up to get free protection for your applications and to get access to all the features.
@@ -1,6 +1,7 @@
1
1
  import IORedis from "ioredis";
2
2
  /**
3
- * A wrapper class for the Redis client to manage connections and provide a centralized client instance.
3
+ * A wrapper class for the Redis client. This class manages connections and provides
4
+ * a centralized client instance for a Redis database.
4
5
  */
5
6
  export declare class RedisWrapper {
6
7
  private _redisClient?;
@@ -14,11 +15,14 @@ export declare class RedisWrapper {
14
15
  */
15
16
  get client(): IORedis;
16
17
  /**
17
- * Connect to the Redis server using the specified host and port.
18
- *
19
- * The client instance will be stored in the `_redisClient` property for later access.
20
- */
21
- connect(): void;
18
+ * Connect to the Redis server using the specified host and port.
19
+ *
20
+ * The client instance will be stored in the `_redisClient` property for later access.
21
+ *
22
+ * @param {string} host - The Redis server host address (default is "customer-redis-srv").
23
+ * @param {number} port - The Redis server port number (default is 6379).
24
+ */
25
+ connect(host?: string, port?: number): void;
22
26
  }
23
27
  /**
24
28
  * Singleton instance of the RedisWrapper class to provide a centralized Redis client connection.
@@ -6,7 +6,8 @@ Object.defineProperty(exports, "__esModule", { value: true });
6
6
  exports.redisWrapper = exports.RedisWrapper = void 0;
7
7
  const ioredis_1 = __importDefault(require("ioredis"));
8
8
  /**
9
- * A wrapper class for the Redis client to manage connections and provide a centralized client instance.
9
+ * A wrapper class for the Redis client. This class manages connections and provides
10
+ * a centralized client instance for a Redis database.
10
11
  */
11
12
  class RedisWrapper {
12
13
  constructor() {
@@ -25,12 +26,15 @@ class RedisWrapper {
25
26
  return this._redisClient;
26
27
  }
27
28
  /**
28
- * Connect to the Redis server using the specified host and port.
29
- *
30
- * The client instance will be stored in the `_redisClient` property for later access.
31
- */
32
- connect() {
33
- this._redisClient = new ioredis_1.default({ host: this.host, port: this.port, maxRetriesPerRequest: null });
29
+ * Connect to the Redis server using the specified host and port.
30
+ *
31
+ * The client instance will be stored in the `_redisClient` property for later access.
32
+ *
33
+ * @param {string} host - The Redis server host address (default is "customer-redis-srv").
34
+ * @param {number} port - The Redis server port number (default is 6379).
35
+ */
36
+ connect(host, port) {
37
+ this._redisClient = new ioredis_1.default({ host: host || this.host, port: port || this.port, maxRetriesPerRequest: null });
34
38
  this._redisClient.on("connect", function () {
35
39
  console.info("Redis Server Connected!");
36
40
  });
package/package.json CHANGED
@@ -1,6 +1,6 @@
1
1
  {
2
2
  "name": "@hastehaul/common",
3
- "version": "1.0.18",
3
+ "version": "1.0.19",
4
4
  "description": "",
5
5
  "main": "./build/index.js",
6
6
  "types": "./build/index.d.ts",