Cache optimization
This commit is contained in:
parent
0114d534bb
commit
62f955a5f0
2 changed files with 9 additions and 6 deletions
1
.gitignore
vendored
1
.gitignore
vendored
|
@ -4,3 +4,4 @@ node_modules
|
|||
/build
|
||||
/public/build
|
||||
.env
|
||||
dump.rdb
|
|
@ -35,9 +35,10 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
|
|||
where: eq(rooms.userId, userId || ""),
|
||||
})
|
||||
.then((roomList) => {
|
||||
setCache(`kv_roomlist_${userId}`, roomList, "sp").then(() => {
|
||||
send({ event: userId!, data: JSON.stringify(roomList) });
|
||||
});
|
||||
Promise.all([
|
||||
setCache(`kv_roomlist_${userId}`, roomList, "sp"),
|
||||
send({ event: userId!, data: JSON.stringify(roomList) }),
|
||||
]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
@ -59,9 +60,10 @@ export async function loader({ context, params, request }: LoaderFunctionArgs) {
|
|||
where: eq(rooms.userId, userId || ""),
|
||||
})
|
||||
.then((roomList) => {
|
||||
setCache(`kv_roomlist_${userId}`, roomList, "sp").then(() => {
|
||||
send({ event: userId!, data: JSON.stringify(roomList) });
|
||||
});
|
||||
Promise.all([
|
||||
setCache(`kv_roomlist_${userId}`, roomList, "sp"),
|
||||
send({ event: userId!, data: JSON.stringify(roomList) }),
|
||||
]);
|
||||
});
|
||||
}
|
||||
});
|
||||
|
|
Loading…
Add table
Reference in a new issue