<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN">
<html><body style='font-size: 10pt; font-family: Verdana,Geneva,sans-serif'>
<p>Unfortunately, the question is ambiguous.</p>
<p>You can put it into the structure, you initialized `mycf = ngx_pcalloc(cf->pool, size)`, <br />where cf is `ngx_conf_t *cf`, if you want to save it per location.<br />Then you can get it in the handler, using `mycf = ngx_http_get_module_loc_conf(r, ngx_http_your_module);`...<br /><br />There are many another places, where you can put it. <br />E. g. just as static variable like `static int var`, so valid per module-scope.<br /><br />But you should provide more info what exactly you want do.<br /><br />For example another issue may be also multiple-workers at all (that are processes, not the threads in nginx), so <br />if it should be exactly one counter across all workers, then you should put it into the shared memory (or somewhere in shared pools, using ngx_slab_alloc functions). The good example would be own nginx module "ngx_http_limit_conn_module".<br />Because otherwise, each worker will just get its own counter.<br /><br />Regards,<br />Serg.<br /><br /></p>
<p>Am 09.02.2018 17:31, schrieb Antonio Nappa:</p>
<blockquote type="cite" style="padding-left:5px; border-left:#1010ff 2px solid; margin-left:5px"><!-- html ignored --><!-- head ignored --><!-- meta ignored -->
<div dir="ltr">
<div>
<div>
<div>
<div>Hello,<br /><br /></div>
I am looking for a structure that I can use to store a counter in the module, this structure should not be reset every time there is a new request.<br /><br /></div>
I have made tests with the module custom ctx and the module custom srv configuration without success, which means every time there is a new request the field becomes zero.<br /><br /></div>
Thanks,</div>
Antonio</div>
<br />
<pre>_______________________________________________
nginx-devel mailing list
<a href="mailto:nginx-devel@nginx.org">nginx-devel@nginx.org</a>
<a href="http://mailman.nginx.org/mailman/listinfo/nginx-devel">http://mailman.nginx.org/mailman/listinfo/nginx-devel</a>
</pre>
</blockquote>
</body></html>