Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Handle Reconnect #74

Open
parrajulian opened this issue Oct 16, 2020 · 1 comment
Open

Handle Reconnect #74

parrajulian opened this issue Oct 16, 2020 · 1 comment

Comments

@parrajulian
Copy link

Hi!

I want to provide some functionality to my application while using memcache-plus library.

I'm currently using the library as part of my project, also I've MemCachier (heroku add-on) as my cache's server. The thing is that I need to authenticate to the server and I did something like proposed here: https://www.memcachier.com/documentation/supported-protocols-ascii-binary. Basically, I'm setting a cache item right after the connection attempt with key=username and value=password so it can establish connection. The issue that I have been experiencing is how to deal with reconnection if the server has any failure, is there a way to set a callback function when trying to reconnect? I need to set that username/password item again in order to avoid connection failure.

I will really appreciate any help that you can provide, by the way great work with the library!

Thank you

@victorquinn
Copy link
Owner

victorquinn commented Oct 16, 2020

Oooh this is cool, didn't know it was a thing!

Would love to add support to this library for this. I think we are using the ASCII protocol which is likely why you're running into issues, but there's no reason we couldn't support binary as well, I'd envision it as an option we send to the initialization (with the default being ASCII) so something like this:

const MemcachePlus = require('memcache-plus')

const client = new MemcachePlus({
    hosts: 'my-memcached-host.com',
    binary: true,
})

Happy to accept a PR or add to the backlog

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants