This is a discussion on Apache Module: Sharing information between requests within the Linux Web Servers forums, part of the Web Server and Related Forums category; Hello, My module needs to share information between different requests. As a simple example, let's say that it wants ...
|
|||||||
| FAQ | Members List | Calendar | Search | Today's Posts | Mark Forums Read |
|
|||
|
Hello,
My module needs to share information between different requests. As a simple example, let's say that it wants to store the remote_ip of every request it gets and and output the whole list of IPs as a response to every request it gets (Just an example, this is not what I want to do ;-)). So I need some "global memory" where I can store these values. What would be the appropriate mechanism for that? I realize that I could [ab?]use the module_config using ap_set_module_config() for this, but I'm not sure if there is not a more appropriate way to do it? Many thanks, Michael |
|
|||
|
In article <7562d656.0412230318.621ff58c@posting.google.com >,
mike@unfolded.com (Michael Ransburg) writes: > Hello, > > My module needs to share information between different requests. As a > simple example, let's say that it wants to store the remote_ip of > every request it gets and and output the whole list of IPs as a > response to every request it gets (Just an example, this is not what I > want to do ;-)). Bad example. The implication is that you probably need educating on the meaning of remote IP addressess on the web. Distracting. > So I need some "global memory" where I can store > these values. What would be the appropriate mechanism for that? I That depends. A general solution needs to work cross-MPM. You could use apr_shm, but dbm would probably be easier and at least as good. > realize that I could [ab?]use the module_config using > ap_set_module_config() for this, but I'm not sure if there is not a > more appropriate way to do it? That is an appropriate way if you're happy for your pool to be kept per-process, particularly if - as seems likely - only one virtual host cares about this. You will of course need to use the appropriate module config and prevent race conditions updating it. -- Nick Kew |
| Thread Tools | |
| Display Modes | |
|
|