123456789101112131415161718192021 |
- import { pubClient } from "../connection/redis.js";
- const updateUser = async (userId, userObj) => {
- // const user = await pubClient.exists(userId);
- // if (user === 1) {
- // await pubClient.hSet(userId, userObj);
- // }
- await pubClient.hSet(userId, userObj.from, JSON.stringify(userObj));
- await pubClient.expire(userId, 60 * 60 * 24);
- };
- const removeRoomAllUsers = (roomId) => {
- return pubClient.del(roomId);
- };
- const removeRoomUser = (roomId, useId) => {
- return pubClient.hDel(roomId, useId);
- };
- export { updateUser, removeRoomAllUsers, removeRoomUser };
|