✅ How to correctly implement a lobby system with Redis?
I am making a web game using SignalR and am looking to scale horizontally. Right now I'm designing a service to create, delete, and connect to a lobby. I want to make it possible for 1 player to be in only 1 lobby at the moment. I chose Redis as the storage for this. How should I describe player and lobby states using Redis features? I had an idea to make two key-value stores, one that will store the id of the lobby to which the player is connected by player id. And in the second repository for the lobby ID, store the json description of the lobby (name, password). But in this case, I have the following problems: how to generate a unique ID for the lobby using redis? And maybe there is a way using some data structures to make a quick search for all the players in the same lobby? (faster than O(n))? Or might it be worth storing the state in a completely different way?