Closed shairontoledo closed 13 years ago
On Wed, May 11, 2011 at 2:40 AM, shairontoledo reply@reply.github.com wrote:
Hi agentzh,
Thank you to make this project, I really appreciate your modules(manly this one). So, I have some problems to get a value from memcached, the value is shown in http body but $memc_flags is empty(int zero). Here is my code.
How did you store the key-value pair into your memcached server? Have you passed a non-zero flag when you store it?
You can check the flag of your entry in memcached via telnet:
telnet your_host your_port
then type the command "get
Step 1. start telnet to connect directly to memcached (the memcached server is on my localhost):
telnet 127.0.0.1 11211
Step 2. Fetch a key by typing the following command in the telnet session:
get foo
The memcached returns the following stuff when I hit the enter key:
VALUE foo 0 5
hello
END
Here, the "foo" key has the value "hello" and the number 5 is the length of its value. And the number is the flag associated with the key "foo". You can do similar check on your keys ;)
Regards, -agentzh
On Wed, May 11, 2011 at 11:50 AM, agentzh agentzh@gmail.com wrote:
The memcached returns the following stuff when I hit the enter key:
VALUE foo 0 5 hello END
Here, the "foo" key has the value "hello" and the number 5 is the length of its value. And the number is the flag associated with the key "foo".
Sorry, I meant "And the number 0 is the flag associated with the key foo" :P
Best, -agentzh
Yes, the key has value, I said that everything is correct except the content of $memc_flags, you can see the value of the key in the previous post, it returns in http body
* Closing connection #0 cf35074d1b0e62278562d026f3c7f743
but not in $memc_flags. I'd like to get the value in $memc_flags to do a condition to take a decision.
Thank you
On Wed, May 11, 2011 at 8:08 PM, shairontoledo reply@reply.github.com wrote:
Yes, the key has value, I said that everything is correct except the content of $memc_flags, you can see the value of the key in the previous post, it returns in http body
* Closing connection #0 cf35074d1b0e62278562d026f3c7f743
The "value" is very different from the "flag". An entry in the memcached server consists of three parts, the key, the value, and the flag. The flag is usually a 32-bit integer (and was 16-bit in old versions of memcached). A key does have a non-empty value does not mean anything about a non-zero flag.
To quote the related section in the memcached protocol specification:
<flags> is an arbitrary 16-bit unsigned integer (written out in
decimal) that the server stores along with the data and sends back
when the item is retrieved. Clients may use this as a bit field to
store data-specific information; this field is opaque to the server.
Note that in memcached 1.2.1 and higher, flags may be 32-bits, instead
of 16, but you might want to restrict yourself to 16 bits for
compatibility with older versions.
Please consult the full memcached protocol spec for more details:
http://code.sixapart.com/svn/memcached/trunk/server/doc/protocol.txt
Regards, -agentzh
hmm makes sense now, thank you. Is there a way to use a memcached value in nginx context using memc-nginx-module?
On Wed, May 11, 2011 at 9:19 PM, shairontoledo reply@reply.github.com wrote:
hmm makes sense now, thank you. Is there a way to use a memcached value in nginx context using memc-nginx-module?
What do you mean by "use"?
I'm guessing you want to manipulate the values returned by ngx_memc the way you want? You can check out the ngx_lua module which provides Lua API that allows you to issue subrequests to your locations configured by ngx_memc and process the responses in an arbitrary way in Lua:
http://github.com/chaoslawful/lua-nginx-module
Regards, -agentzh
ok thank you
Hi agentzh,
Thank you for make this project, I really appreciate your modules(manly this one). So, I have some problems to get a value from memcached, the value is shown in http body but $memc_flags is empty(int zero). Here is my code.
Request and response from curl
As you can see in the header, the content of $memc_flags is 0 and also I've noticed that Last-Modified time is constant (similar of src/ngx_http_memc_handler.c:606 len = sizeof("Mon, 28 Sep 1970 06:00:00 GMT") - 1;)
I've been using nginx/1.0.1, my "nginx -V" is :
OS
I was suspecting about nginx version 1.0.1, then I ran the tests here then I got successful
So, do you have an idea about how can I fix that?