On 10/3/07, omat <[EMAIL PROTECTED]> wrote: > I used it for some time and observed some inconsistencies. I think > this is because the code is not thread-safe. > > Do you know a thread safe way of applying this approach?
Well, "thread-safe" is a confusing term for something like this, but you're right that it has to do with the operating environment. I had similar problems with an application of mine, when I used a module-level dictionary to store a cache that would be updated. What I ended up having to do is using Django's cache framework, which will work fine in multi-process setups, as long as you don't use the "simple" or "local" cache backends. Don't let the local backend's claim of being multi-process thread-safe fool you. What that means is that multiple threads and processes won't interact with each other, which is the usual definition of the term. But since you actually do want multiple threads and processes to share that information, its multi-process/thread-safety is actually a problem. That's why I said it's a confusing term for this situation. If you use the file, db or memcached backends, you should be fine. -Gul --~--~---------~--~----~------------~-------~--~----~ You received this message because you are subscribed to the Google Groups "Django users" group. To post to this group, send email to django-users@googlegroups.com To unsubscribe from this group, send email to [EMAIL PROTECTED] For more options, visit this group at http://groups.google.com/group/django-users?hl=en -~----------~----~----~----~------~----~------~--~---