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

reading protobuf values #15

Open
NotYoCheese opened this issue Aug 25, 2017 · 3 comments
Open

reading protobuf values #15

NotYoCheese opened this issue Aug 25, 2017 · 3 comments

Comments

@NotYoCheese
Copy link

I am trying to read memcached values that are protocol buffers, however I always get a nil result with no error. If I set a key with a test string myself from lua-resty I can read it back. I can also echo get KEY | nc memcached_server 11211 and see that the protobuf encoded value is present. Seems like a common use case, am I missing a config option?

@agentzh
Copy link
Member

agentzh commented Aug 25, 2017

@NotYoCheese Maybe you use special characters in the memcached keys? This library encodes the keys by URI escaping sequences by default. You can turn that off. Read the docs please.

@agentzh
Copy link
Member

agentzh commented Aug 25, 2017

@NotYoCheese If it's not that problem, then please provide a minimal and standalone example that we can easily run and reproduce the problem on our side. Just try removing as many things as possible as long as the issue still persists. Thank you. Otherwise we cannot really help you debug the issue at all.

@NotYoCheese
Copy link
Author

I'm so sorry. It was actually the url encoding of the keys that was the issue. All our keys are in the form of "prefix:key" and the colon was being url encoded. When I set a test key of sf:test to a string from resty-memcached, of course it was found. I resolved this by creating a no-op function:
function noop(s)
return s
end

and passing it in to the new function:

local memc, err = memcached:new{key_transform = {noop, noop}}

I read a post about the binary protocol not being supported and I conflated that with binary values not being supported. Thanks for responding so quickly.

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

No branches or pull requests

2 participants