Cannot get the value from dogpile.cache from different modules.

Peter Otten __peter__ at web.de
Tue Dec 29 11:17:33 EST 2015


xeon Mailinglist wrote:

> On Tuesday, December 29, 2015 at 11:16:10 AM UTC, xeon Mailinglist wrote:
>> 1. How do I create a global variable that can be accessed by all classes?
>> 
>> 2. I am using `dogpile.cache` to store data in the cache [1], but if I
>> set and get the same key from different modules, I don't get the value.
>> Here is an example in [2]. The value than I get is `NO_VALUE.NO_VALUE`.
>> Why this happens?

>>     region = make_region().configure('dogpile.cache.memory')

The memory backend wraps a python dict whose contents are only available to 
a single script and forgotten when that script ends.

My crystal ball tells me that you want to communicate between processes 
rather than "modules" and need a backend that implements persistence. 
"dogpile.cache.file" seems to be the one without dependencies outside the 
standard library.






More information about the Python-list mailing list