Welcome! Log In Create A New Profile

Advanced

Re: Setting cache parameters via if directives

agentzh
February 01, 2011 03:56AM
On Tue, Feb 1, 2011 at 4:47 PM, agentzh <agentzh@gmail.com> wrote:
> Consider the following config snippet:
>
>    location /test {
>        set $a 3;
>        if ($a = 3) {
>            set $a 4;
>        }
>        echo $a;
>    }
>
> GET /test will give you nothing for nginx 0.7.21 ~ 0.9.4.

Forgot to mention that we've been in favor of ngx_lua's set_by_lua and
rewrite_by_lua directives to do something like this:

location /test {
set $a 3;
set_by_lua $a '
if ngx.var.a == "3" then
return 4
end
';
echo $a;
}

and GET /test will give you the expected answer, "4" and the
performance remains outstanding especially when you've enabled LuaJIT
2.0 ;)

Cheers,
-agentzh

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

Setting cache parameters via if directives

Jeff Mitchell January 28, 2011 12:10AM

Re: Setting cache parameters via if directives

Ryan Malayter January 28, 2011 11:00AM

Re: Setting cache parameters via if directives

Jeff Mitchell January 29, 2011 03:24AM

Re: Setting cache parameters via if directives

Jeff Mitchell January 29, 2011 11:10AM

Re: Setting cache parameters via if directives

agentzh February 01, 2011 03:50AM

Re: Setting cache parameters via if directives

agentzh February 01, 2011 03:56AM

Re: Setting cache parameters via if directives

Ryan Malayter February 01, 2011 10:50AM

Re: Setting cache parameters via if directives

valor January 29, 2011 07:02PM



Sorry, only registered users may post in this forum.

Click here to login

Online Users

Guests: 197
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