mqemitter-redis
Advanced tools
Comparing version 6.0.0 to 6.1.0
@@ -28,4 +28,4 @@ 'use strict' | ||
this._cache = new LRUCache({ | ||
max: 10000, | ||
ttl: 60 * 1000 // one minute | ||
max: opts.maxLRUCache || 10000, // default: 10k | ||
ttl: opts.ttlLRUCache || 60 * 1000 // default: one minute | ||
}) | ||
@@ -32,0 +32,0 @@ |
{ | ||
"name": "mqemitter-redis", | ||
"version": "6.0.0", | ||
"version": "6.1.0", | ||
"description": "Redis-based MQEmitter", | ||
@@ -5,0 +5,0 @@ "main": "mqemitter-redis.js", |
@@ -13,6 +13,11 @@ import type { RedisOptions } from 'ioredis'; | ||
export interface LRUCacheOptions { | ||
ttlLRUCache?: number;// Time to live for the LRU cache in milliseconds | ||
maxLRUCache?: number;// Maximum number of items in the LRU cache | ||
} | ||
export type Message = Record<string, any> & { topic: string }; | ||
export interface MQEmitterRedis extends MQEmitter { | ||
new (options?: MQEmitterOptions & RedisOptions): MQEmitterRedis; | ||
new (options?: MQEmitterOptions & RedisOptions & LRUCacheOptions): MQEmitterRedis; | ||
current: number; | ||
@@ -35,5 +40,5 @@ concurrent: number; | ||
declare function MQEmitterRedis( | ||
options?: MQEmitterOptions & RedisOptions | ||
options?: MQEmitterOptions & RedisOptions & LRUCacheOptions | ||
): MQEmitterRedis; | ||
export default MQEmitterRedis; |
@@ -32,2 +32,9 @@ import { expectError, expectType } from 'tsd'; | ||
expectType<MQEmitterRedis>( | ||
mqEmitterRedis({ | ||
maxLRUCache: 100, | ||
ttlLRUCache: 10000, | ||
}) | ||
); | ||
function listener(message: Message, done: () => void) {} | ||
@@ -34,0 +41,0 @@ |
16338
385