Create docWriteThrough redis cache

This commit is contained in:
Adria Navarro 2024-02-29 11:22:27 +01:00
parent a093cfca99
commit 40cc383c01
2 changed files with 13 additions and 1 deletions

View File

@ -9,7 +9,8 @@ let userClient: Client,
lockClient: Client, lockClient: Client,
socketClient: Client, socketClient: Client,
inviteClient: Client, inviteClient: Client,
passwordResetClient: Client passwordResetClient: Client,
docWritethroughClient: Client
export async function init() { export async function init() {
userClient = await new Client(utils.Databases.USER_CACHE).init() userClient = await new Client(utils.Databases.USER_CACHE).init()
@ -24,6 +25,9 @@ export async function init() {
utils.Databases.SOCKET_IO, utils.Databases.SOCKET_IO,
utils.SelectableDatabase.SOCKET_IO utils.SelectableDatabase.SOCKET_IO
).init() ).init()
docWritethroughClient = await new Client(
utils.Databases.DOC_WRITE_THROUGH
).init()
} }
export async function shutdown() { export async function shutdown() {
@ -104,3 +108,10 @@ export async function getPasswordResetClient() {
} }
return passwordResetClient return passwordResetClient
} }
export async function getDocWritethroughClient() {
if (!writethroughClient) {
await init()
}
return writethroughClient
}

View File

@ -30,6 +30,7 @@ export enum Databases {
LOCKS = "locks", LOCKS = "locks",
SOCKET_IO = "socket_io", SOCKET_IO = "socket_io",
BPM_EVENTS = "bpmEvents", BPM_EVENTS = "bpmEvents",
DOC_WRITE_THROUGH = "docWriteThrough",
} }
/** /**