userService.js 448 B

12345678910111213141516
  1. import { pubClient } from "../connection/redis.js";
  2. const updateUser = async (userId, userObj) => {
  3. await pubClient.hSet(userId, userObj.from, JSON.stringify(userObj));
  4. await pubClient.expire(userId, 60 * 60 * 24);
  5. };
  6. const removeRoomAllUsers = (roomId) => {
  7. return pubClient.del(roomId);
  8. };
  9. const removeRoomUser = (roomId, useId) => {
  10. return pubClient.hDel(roomId, useId);
  11. };
  12. export { updateUser, removeRoomAllUsers, removeRoomUser };