[mod_python] persistent storage?

Damjan arhiv at freemail.org.mk
Mon Dec 18 12:09:54 EST 2000


> Is there a way to mimc the Application object in ASP or the __persistdict__
> object in pyApache
> with modpython??? so that all cgis running can share this storage space for
> data.

You can use somehing like this:

### mod_test.py
cache = {}
def handler(req):
	global cache
	if cache.has_key('num'):
		cache['num'] = cache['num'] + 1
	else:
		cache['num'] = 1
	...

BUT, this is per apache-process persistent storage. Curently there is no way of
sharing data accross processes, except for going through a database.
Apache-2.0 may change this, when it provides a shared memory support.

What I would like to know, how does the above script work in a multithreaded
Apache/mod_python? 
Will the threads share the 'cache' object?


-- 
Damjan Georgievski		|           Дамјан Георгиевски
Skopje, Macedonia		|           Скопје, Македонија



More information about the Mod_python mailing list