tags:

views:

89

answers:

2

I want to keep some global objects in an Apache C++ module persistent across Apache child process invocations. How do I do this?

+1  A: 

I can't tell you exactly how to do this, but the following article may help you along the way: http://www.apachetutor.org/dev/pools

Jordan S. Jones
+2  A: 

You must use some form of storage external to the Apache processes.

Basic choices:

  • A database.
  • Shared memory (OS dependent).
  • Another process and use an IPC mechanism (eg. a socket)
  • A file.

Which one is appropriate depends on your requirements, and you might combine them. For example, "a database" is actually implemented as another process that makes things persistent in a file and it deals with concurrency issues in a known way.

In general, a database is probably the first thing to try and only go to other alternatives if you have specific issues that can be solved by taking a different approach.

janm