Skip to content

RedisInvitationStore

The InvitationStore on Redis.

  • InvitationStore

new RedisInvitationStore(redis, options?): RedisInvitationStore

Redis

Pick<RedisStoreOptions, "prefix"> = {}

RedisInvitationStore

consume(hash): Promise<StoredInvitation | null>

Atomically removes and returns the invitation: of many concurrent callers exactly one gets it.

string

Promise<StoredInvitation | null>

InvitationStore.consume


create(invitation, now): Promise<boolean>

Stores the invitation unless a live one (expiring after now) exists for the same scope and address: then false, and nothing written. An expired one is replaced. Of many concurrent creates for one scope and address, at most one gets true. The store may drop an invitation after expiresAt.

StoredInvitation

number

Promise<boolean>

InvitationStore.create


deleteByInviter(inviterId, scope?): Promise<void>

Deletes every invitation inviterId sent, or with scope only those to that scope.

string

string

Promise<void>

InvitationStore.deleteByInviter


findByHash(hash): Promise<StoredInvitation | null>

The invitation with this hash (expired or not: the caller checks).

string

Promise<StoredInvitation | null>

InvitationStore.findByHash


listByScope(scope, now): Promise<StoredInvitation[]>

The scope’s invitations that expire after now, in no particular order.

string

number

Promise<StoredInvitation[]>

InvitationStore.listByScope


revoke(scope, id): Promise<boolean>

Deletes the invitation with this id if it belongs to scope; whether it did.

string

string

Promise<boolean>

InvitationStore.revoke