floatinghotpot / casino-server

:fire: An online poker game server powered by Redis, node.js and socket.io
MIT License
1.05k stars 469 forks source link

Redis persistence store #4

Closed zilveer closed 9 years ago

zilveer commented 9 years ago

I Am pretty new to redis, does the game store account info and player info as redis persistence store or is everything lost when the computer is shut down?

floatinghotpot commented 9 years ago

redis auto save data to disk in dump.rdb, so everything can be persistence, user account and data (coins, score, exp, level) is in key "user:#{uid}".

floatinghotpot commented 9 years ago

in redis-cli, type 'keys' to see all keys, type 'keys user:#*' to list all user record, type 'hgetall user:#uid' to see one user record.

zilveer commented 9 years ago

Ok thx for the reply.. May I ask why you choose redis instead of mongodb to store the account and player info?

floatinghotpot commented 9 years ago

here is the answer: http://www.badrit.com/blog/2013/11/18/redis-vs-mongodb-performance#.VLPTgmSUdQ4

and a picture: redis_vs_mongodb

floatinghotpot commented 9 years ago

and here: http://kkovacs.eu/cassandra-vs-mongodb-vs-couchdb-vs-redis

redis is not only a key-value database, but also has pub/sub for messaging, which is a big plus, used in casino-server as message bus.

zilveer commented 9 years ago

Wow.. didnt know that.. Then you really have done the correct chose=)