combine concurrent gets for the same keys into one get/multiget to the memcache server
combine concurrent gets for the same keys into one get/multiget to the server
// first you need memcached. (or something that implements the methods get and getMulti)var Memcached = require'memcached';var multi = require'memcache-multiplex';var getter = multi'127.0.0.1:11211';// all of these callsgetterget'hi'console.log'the value of hi'vgetterget'hi'console.log'the value of hi'vgetterget'hi'console.log'the value of hi'v// make only one call to the memcache server// get a,bgettergetMulti'a''b';// get c but not b because im alredy fetching bgettergetMulti'b''c';// no call is made im already requesting the keys im searching for.gettergetMulti'a''c';// triggers 2 "getMulti" on the client driver.// one for keys ['a','b'] and one for just key ['c']
gets the key
get multiple keys
stats is an object
it has stats that help you determine how well you are multiplexing
rant! if you use node you should not make multiple concurrent gets for the same external resources. this applies to databases web services whatever.