Class
MessageCache
Per-channel message cache with FIFO eviction.
- `false` limit → caching disabled
- `Infinity` / unbounded → no per-channel cap
- positive → max messages per channel
Outer map of channel caches is itself FIFO-bounded by `getChannelLimit`.
get never creates empty maps (use add).
Constructor
new MessageCache
(getLimit: () => MessageLimit, getChannelLimit: () => number)| Param | Type | Description |
|---|---|---|
| getLimit | () => MessageLimit | |
| getChannelLimit | () => number |
Properties
caches
: Map<string, Map<string, APIMessage>> | nullMethods
add
(channelId: string, data: APIMessage): void| Param | Type | Description |
|---|---|---|
| channelId | string | |
| data | APIMessage |
clearChannel
(channelId: string): void| Param | Type | Description |
|---|---|---|
| channelId | string |
get
(channelId: string): Map<string, APIMessage> | nullReturn the existing per-channel map, or `null` if disabled / not yet created. Does **not** create empty maps.
| Param | Type | Description |
|---|---|---|
| channelId | string |
remove
(channelId: string, messageId: string): void| Param | Type | Description |
|---|---|---|
| channelId | string | |
| messageId | string |
reset
(): voidstats
(): MessageCacheStatssweep
(filter?: (message: APIMessage, channelId: string) => boolean, channelId?: string): number| Param | Type | Description |
|---|---|---|
| filter? | (message: APIMessage, channelId: string) => boolean | |
| channelId? | string |