memcachier / memjs

A memcache client for node using the binary protocol and SASL authentication
MIT License
197 stars 52 forks source link

MCRouter issue #166

Closed andreafspeziale closed 2 years ago

andreafspeziale commented 2 years ago

Hello!

I'm playing with the library and I'm using MCRouter in front of multiple memcached instance but unfortunately it is not working.

Using the following snippet:

// index.js
const m = require('memjs');

(async () => {
  const client = new m.Client.create('MCROUTER_IP:11211', { expires: 60 });

  try {
    await client.set('hello', 'world', {});
    const cached = await client.get('hello');
    console.log('CACHED: ', cached);
  } catch (err) {
    console.error('ERR: ', err);
  }
})();

The node index.js output has no errors at all and wont console.log('CACHED'). Actually wont console.log anything.

I randomly found also this issue https://github.com/helm/charts/issues/7718 on the internet which seems the same problem.

Do you have any suggestion? Thanks in advance

saschat commented 2 years ago

memjs only supports the binary Memcached protocol. It seems to me, however, MCRouter only supports the ASCII protocol. As such, they are incompatible. You need to use an ASCII Memcached client.

andreafspeziale commented 2 years ago

@saschat TY so much, I believe u saved me from hours of discovery. Which JS/TS client (supporting ASCII) would u recommend? They seems all a little bit unmaintained 🤔

saschat commented 2 years ago

Not really. You are right, the most popular seems unmaintained (https://github.com/3rd-Eden/memcached/issues/318). It might still work, though.