httpd-dev mailing list archives

Site index · List index
Message view « Date » · « Thread »
Top « Date » · « Thread »
From Nick Kew <n...@webthing.com>
Subject Re: Using hash tables globally ...
Date Mon, 09 Jun 2008 18:58:05 GMT
On Mon, 09 Jun 2008 19:59:05 +0200
Kiffin Gish <kiffin.gish@tomtom.com> wrote:

> In my hook_translate_name() routine I save the calculations in the
> hash, but the next time hook_translate_name() is called, the hash no
> longer contains this/any value, it's disappeared.

That'll be because you got a different process next time.

> What do I need to do to make this hash table persistent globally and
> be updated properly within each url request?

If this is just a matter of efficiency, then what you're doing
is probably already right.  Each process will grow its own cache,
which is less efficient than you hoped, but only by O(1).

Note that you shouldn't use pconf when processing a request.
Your module can create its own private pool.  You'll still
need to take care with memory use and thread-safety when
using it.

-- 
Nick Kew

Application Development with Apache - the Apache Modules Book
http://www.apachetutor.org/

Mime
View raw message