Welcome! Log In Create A New Profile

Advanced

Re: Feedback on my module

agentzh
April 01, 2011 11:52PM
On Fri, Apr 1, 2011 at 10:44 PM, Umesh Sirsiwal <usirsiwal@verivue.com> wrote:
> Hey Tarek,
> You can use combination of nginx_memc (http://wiki.nginx.org/HttpMemcModule)
> and nginx_lua (https://github.com/chaoslawful/lua-nginx-module) to achieve
> the same result.
>
> Here is an example:
>

Well, there's just some small grammatical errors in the code sample ;)

> location /blah {
> rewrite_by_lua '
> if($http_x_target_service == nil) then

if ngx.var.http_x_target_service == nil then

> return
> end
> local res = ngx.location.capture("/memc/$http_x_target_service")
>
> if res.status != ngx.HTTP_OK then

if res.status ~= ngx.HTTP_OK then

> ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
> return
> end
> if(res.body != "up") then

if res.body ~= "up" then

> ngx.exit(ngx.HTTP_SERVICE_UNAVAILABLE)
> return

There's no effect to explicitly "return" when ngx.exit() is used
because ngx.exit() will never return back ;)

> end
> ';
>

Anyway, thank you for your code sample, Umesh :)

Cheers,
-agentzh

_______________________________________________
nginx-devel mailing list
nginx-devel@nginx.org
http://nginx.org/mailman/listinfo/nginx-devel
Subject Author Views Posted

Feedback on my module

Tarek Ziade 2167 April 01, 2011 08:08AM

Re: Feedback on my module

Umesh Sirsiwal 697 April 01, 2011 10:46AM

Re: Feedback on my module

Tarek Ziade 724 April 01, 2011 12:30PM

Re: Feedback on my module

agentzh 689 April 01, 2011 11:52PM

RE: Feedback on my module

Sirsiwal, Umesh 966 April 02, 2011 12:32AM



Sorry, you do not have permission to post/reply in this forum.

Online Users

Guests: 224
Record Number of Users: 8 on April 13, 2023
Record Number of Guests: 421 on December 02, 2018
Powered by nginx      Powered by FreeBSD      PHP Powered      Powered by MariaDB      ipv6 ready