-
Notifications
You must be signed in to change notification settings - Fork 29
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
Values with linefeeds (\n) don't work properly #51
Comments
Oh no, that's not great! This has to do with the line-level protocol we are using for interfacing with Memcache -- a new line will break it. Need to find a good solution here. We could convert all \n to something else, then back when we pull it out, however doing that may break integrations with other systems. We should probably audit how other Memcache libraries deal with this and do the same. Anyway, for your purposes until we can roll out a fix, you could convert \n to something else, then back when you pull out though I know this isn't ideal long-term |
Ok, I hacked a solution together for what I'm doing. Rather than replacing the \n's with an arbitrary string and converting back (which is slow for very large strings), I instead wrap up the string in an object and unwrap it on retrieval. So when I set the value, I do:
And then when I get the value I do:
I wonder if this is an approach you could take. |
memcache already returns the size of the stored value, you don't need to parse the line, just read the N bytes that memcache is reporting... |
Have you found any NodeJS modules that implement this properly? We ran into serious issues using memcache-plus or the forked memcache-pp when the value is an empty string or literally the string "END" because of the parsing here which does not use the length in the VALUE response at all. |
I fixed this in https://github.com/ryanrubleycoates/memcache-ppp to read the proper number of bytes and not mangle newlines. It can still be made to work with carrier with a few changes here and there. |
When I set something into memcache where the value is a multi-lined string (delimiter of \n), when I get the value back, it contains only the last line.
The text was updated successfully, but these errors were encountered: