Hello!
On Tue, Jul 23, 2013 at 2:09 PM, Maxwell Leonardo wrote:
> first at all, thanks for all the work on this nginx module, its very
> usefull.
>
I'm glad to hear that :)
> I've been using the HttpMencModule for about a month to cache some images
> and other contents. So, after reading all the online material that I found,
> I just cant figure out a way to do something simple like sending a command
> "stats items" to my memcached server.
> Is that possible?
>
> I tried set $memc_cmd 'stats itens' and my nginx retuns "400 Bad Request"
>
The "stats items" command is not supported yet in this module. You're
welcome to provide a patch.
Alternatively, you can use the lua-resty-memcached library with the
ngx_lua module instead:
https://github.com/agentzh/lua-resty-memcached
This Lua library supports the "stats items" command, for example,
location /t {
content_by_lua '
local memcached = require "resty.memcached"
local memc = memcached:new()
memc:set_timeout(1000) -- 1 sec
local ok, err = memc:connect("127.0.0.1", 11211)
if not ok then
ngx.say("failed to connect: ", err)
return
end
local lines, err = memc:stats("items")
if not lines then
ngx.say("failed to stats items: ", err)
return
end
ngx.say("stats items:\\n", table.concat(lines, "\\n"))
local ok, err = memc:set_keepalive()
if not ok then
ngx.say("failed to set keepalive: ", err)
return
end
';
}
BTW, it should be "HttpMemcModule" instead of "HttpMencModule".
BTW, I'm cc'ing the openresty-en mailing list:
https://groups.google.com/group/openresty-en You're encouraged to join
the openresty-en mailing list and ask such questions there :)
Best regards,
-agentzh