Memcached/JSONP

agentzh agentzh at gmail.com
Mon Dec 21 12:40:20 MSK 2009


On Mon, Dec 21, 2009 at 3:14 PM, Marcus Clyne <ngx.eugaia at gmail.com> wrote:
> Have a look at Agentz's echo module too, specifically the echo_location /
> echo_location_async.  This may (should) be quicker than running subrequests
> through SSI, because the SSI would need to be parsed for each request, but
> the logic would only need to be read once for the echo_XXX functions.
>  Unless you're using if...else clauses in your SSI, I think everything you
> can do with SSI can be done with the echo module.
>

Oh, Marcus, indeed you're right! :D

I've just tried out the following and it works:

    location /blah {
        echo_duplicate 1 "$arg_callback(";
        echo_location_async "/data?$uri";
        echo_duplicate 1 ")";
    }
    location /data {
        echo_duplicate 1 '{"dog":"$query_string"}';
    }

For request

     GET /blah/9999999.json?callback=ding1111111

you get the response

     ding1111111({"dog":"/blah/9999999.json"})

It should not be hard to hook up fastcgi and memcached settings to
that /data location ;)

It's really a shame that I didn't propose the ngx_echo module written
by myself :P

Enjoy!
-agentzh



More information about the nginx mailing list