Re: Keeping data in memory
Tom Stambaugh <[email protected]> Tue, 9 Feb 2010 19:32:20 -0500
| Newsgroups | gmane.comp.python.mod_python |
|---|---|
| Message-ID | <[email protected]> |
Hi All: First, I want to thank Graham for all the effort he puts into this group and mod_python. This is way, way above and beyond any kind of "duty", and I truly appreciate it. As a test-driven developer, I would **love** to have a unittest (or its equivalent) test suite that demonstrates the various failure mechanisms when the wrong thing is done (for example, when using a simple global variable) and then demonstrates that these fixes solve the problem. Most (all?) of the test suites and testing literature I've seen assume a single-process environment. Before I start removing my few remaining hairs by unnecessary head-scratching, I will greatly appreciate pointers to material that addresses unit tests for an approach where a client (lets say a browser connecting through json to its own python thread) is using resources maintained in a different Python thread, so that multiple client threads are hitting against a shared resource. Presumably two or more parallel client test cases will compete for the shared resource (is it a "testResource" in the original SUnit sense?), fail when the wrong thing is done, and pass when the right thing is in place. Of course, some kind of harness has to set up and fire off all this. Thanks in advance! Tom Graham Dumpleton wrote: True. As described in: http://www.dscpl.com.au/wiki/ModPython/Articles/TheProcessInterpreterModel if you want cross process sharing, you can't rely on global variables and must use an out of process storage mechanism. Graham 2010/2/9 Primožič Boštjan <[email protected]><[email protected]>: It works with global variables, but if there is more than one thred/instance of interpreter there will be problems. Hi, I'd like to know if it's possible and how to store some data in memory. I get small amount of date by parsing some other pages and this takes relativly long time, so I want to keep this data in memory ( if posible ). I heared something about storing this data in "global" variable which stays in memory all the time. Have you actually tried using Google to search for 'Python global variables'. http://www.google.com/search?client=safari&rls=en&q=python+global+variables&ie=UTF-8&oe=UTF-8 Understand what global variables are in Python and you have your answer. Graham _______________________________________________ Mod_python mailing list [email protected] http://mailman.modpython.org/mailman/listinfo/mod_python -- Tom Stambaugh, Founder Zeetix LLC/ZeeGuide/ZeeForge 27 Auburn Street Brookline, MA 02446 617-734-8934 (land) 617-721-0446 (cell) _______________________________________________ Mod_python mailing list [email protected] http://mailman.modpython.org/mailman/listinfo/mod_python