Skip to content
On this page

This is an auto-generated document to support extension builders understand the internal packages they can utilize. To find our written guides, tutorials, and API/SDK reference, check out our main docs .

Directus / @directus/memory / index / BusRedis

Class: BusRedis

Implements

Constructors

new BusRedis(config)

new BusRedis(config): BusRedis

Parameters

config: Omit<BusConfigRedis, "type">

Returns

BusRedis

Source

packages/memory/src/bus/lib/redis.ts:24

Properties

compression

private compression: boolean

Source

packages/memory/src/bus/lib/redis.ts:20


compressionMinSize

private compressionMinSize: number

Source

packages/memory/src/bus/lib/redis.ts:21


handlers

private handlers: Record<string, Set<MessageHandler<any>>>

Source

packages/memory/src/bus/lib/redis.ts:22


namespace

private namespace: string

Source

packages/memory/src/bus/lib/redis.ts:19


pub

private pub: Redis

Source

packages/memory/src/bus/lib/redis.ts:17


sub

private sub: Redis

Source

packages/memory/src/bus/lib/redis.ts:18

Methods

messageBufferHandler()

private messageBufferHandler(channel, message): Promise<void>

To avoid adding unnecessary active handles in node, we have 1 listener for all messages from Redis, and call the individual registered callbacks from the handlers object

Parameters

channel: Buffer

The namespaced channel the message was sent in

message: Buffer

Buffer of the message value that was sent in the given channel

Returns

Promise<void>

NOTE

this method expects the namespaced channel name

Source

packages/memory/src/bus/lib/redis.ts:87


publish()

publish<T>(channel, message): Promise<void>

Publish a message to subscribed clients in the given channel

Type parameters

T = unknown

Parameters

channel: string

Channel to publish to

message: T

Value to send to the subscribed clients

Returns

Promise<void>

Implementation of

Bus.publish

Source

packages/memory/src/bus/lib/redis.ts:34


subscribe()

subscribe<T>(channel, callback): Promise<void>

Subscribe to messages in the given channel

Type parameters

T = unknown

Parameters

channel: string

Channel to subscribe to

callback: MessageHandler<T>

Payload that was published to the given channel

Returns

Promise<void>

Implementation of

Bus.subscribe

Source

packages/memory/src/bus/lib/redis.ts:44


unsubscribe()

unsubscribe(channel, callback): Promise<void>

Unsubscribe from a channel

Parameters

channel: string

Channel to unsubscribe from

callback: MessageHandler

Callback to remove from the stack

Returns

Promise<void>

Implementation of

Bus.unsubscribe

Source

packages/memory/src/bus/lib/redis.ts:60