, , .
, , . . Redis, , , .
, . , . , - :
var storage = new Storage();
storage.registerClientDisconnection("client_id_1");
Storage.registerClientDisconnection()
Storage.proptotype.registerClientDisconnection = function(clientId) {
this.info[clientId].connected = false;
};
Storage.proptotype.registerClientDisconnection = function(clientId) {
var client = redis.createClient();
client.set("clientId:"+clientId+":connected", false);
};
To summarize: I would recommend using some key store, but I'm sure you can use some object store too. However, if you decide to use an in-memory object, simply draw this implementation detail so that you can easily migrate the key store implementation in the future. The above solution seems to be more important than your decision to implement.
source
share