have a look at this for a discussion of exactly that question. http://clj-me.cgrand.net/2011/10/06/a-world-in-a-ref/
https://github.com/cgrand/megaref On Friday, 12 April 2013 07:35:03 UTC+10, James Adams wrote: > > Hi, > > I'm new to Clojure and trying to write a multiplayer poker web app. I'm > looking for advice early on regarding state management. > > I'm using aleph and compojure for the communications with actions from > players coming in through compojure on different threads of the netty > server. > When a message arrives I check which rooms it corresponds based on the url > then update that rooms game state. > > I could store all state in (def rooms (atom {})) with the keys being the > room name and each room containing users and the game state but this would > require that I deref & swap! for every change to the state in any room > which would seem to be a bottleneck. > > Timers are also needed to fold a player if they don't move in time. > > How would you do this? All thoughts welcome and appreciated > > Thanks > > James > > > > -- -- You received this message because you are subscribed to the Google Groups "Clojure" group. To post to this group, send email to [email protected] Note that posts from new members are moderated - please be patient with your first post. To unsubscribe from this group, send email to [email protected] For more options, visit this group at http://groups.google.com/group/clojure?hl=en --- You received this message because you are subscribed to the Google Groups "Clojure" group. To unsubscribe from this group and stop receiving emails from it, send an email to [email protected]. For more options, visit https://groups.google.com/groups/opt_out.
