3rd-Eden / memcached

A fully featured Memcached client build on top of Node.js. Build with scaling in mind so it will support Memcached clusters and consistent hashing.
MIT License
1.31k stars 276 forks source link

Add modula distribution #365

Open clmrb opened 2 years ago

clmrb commented 2 years ago

Hi and thanks for all the effort you put in this library !

We needed modula distribution at my company to be compatible with the default PHP's memcached client config (https://www.php.net/manual/en/memcached.constants.php).

Modula distribution is nothing complicated as it does this.servers[keyHashValue % this.servers.length] to pick the correct server to query. I just disabled hashring if new option modula is set to true and use modula distribution instead.

This is related to https://github.com/3rd-Eden/memcached/issues/311 but I think more companies could face/are facing this issue when dealing with a legacy PHP stack.

Any feedback is welcome !