joshbetz / node-memcached

A Memcached client for modern Node.js with consistent hashing and connection pooling.
4 stars 0 forks source link

Client insights #11

Open andreafspeziale opened 3 days ago

andreafspeziale commented 3 days ago

Hello Josh!

I wanted to reach out and first express my gratitude for your Memcached client implementation. After extensively testing various Memcached clients in the JavaScript ecosystem, I've found yours to be the most compelling solution for several reasons:

I previously attempted to contact you through other channels without success. While I was hesitant to open an issue just to start a conversation, seeing your recent active contributions encouraged me to reach out this way.

I'm currently developing a Memcached wrapper for the NestJS backend framework. As I'm working on version 4, I'd like to switch to your client implementation (Pool). However, I've encountered some questions and concerns that I'd really appreciate your insights on:

  1. I've implemented SuperJSON for value serialization, as it allows caching of boolean and object types beyond the current string and number limitations. I'd appreciate your thoughts on this.
  2. Regarding error handling, I've noticed that .set() and .get() operations return boolean values without throwing exceptions. While this helps identify cache misses and successful operations, it makes it challenging to distinguish connection issues from other failures. The only solution I've found is running .ping() before operations, though this doesn't guarantee connection stability during execution. Do you have any recommendations for more robust error handling?
  3. One notable feature I've seen in other implementations is data compression. As this isn't my area of expertise, I'd value your perspective on potentially incorporating compression capabilities into the client.

I would be incredibly grateful for any opportunity to discuss these points with you. If you'd prefer to continue this conversation through other channels, you can find all my contact information on my public GitHub profile. Your insights would be invaluable in helping shape the development of my wrapper.

Looking forward to hearing your thoughts!

joshbetz commented 2 days ago

I've implemented SuperJSON for value serialization, as it allows caching of boolean and object types beyond the current string and number limitations. I'd appreciate your thoughts on this.

Yep, makes sense. I've done similar in some of my projects.

Do you have any recommendations for more robust error handling?

Good question. I have mainly used the HashPool where I've implemented a polling check https://github.com/joshbetz/node-memcached/blob/main/src/hashpool.ts#L57-L61

One notable feature I've seen in other implementations is data compression. As this isn't my area of expertise, I'd value your perspective on potentially incorporating compression capabilities into the client.

This is an interesting idea. Do you have examples?