[ANN] ngx_lua v0.1.5: ability to capture multiple parallelsubrequests

Akins, Brian Brian.Akins at turner.com
Thu Feb 10 21:12:52 MSK 2011


 agentzh,

I was wondering if you had considered having a capture mode that used a
callback rather than coroutines?  In really high traffic servers, the
coroutines seem to eat a good bit of memory.

An example use could be:

Define a callback

function mycallback(res)
  do_stuff_with_res
end 

Then later.. 

ngx.location.capture("/some_other_location", mycallback)


You could also pass closures as well:

 x = something_I_care_about
 callback = function (res) return someothercallback(res, x) end
 ngx.location.capture("/some_other_location", callback)


My Lua is a little rusty, but you get the idea.

-- 
Brian Akins




More information about the nginx mailing list