Cannot get the value from dogpile.cache from different modules.
xeon Mailinglist
xeonmailinglist at gmail.com
Tue Dec 29 12:13:43 EST 2015
On Tuesday, December 29, 2015 at 4:18:10 PM UTC, Peter Otten wrote:
> 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.
No. My problem is that I have method1() that calls method2() which calls myset(). method1() -> method2() -> myset(5). My problem is that, if I try to get the value of myset() inside method1(), I can't have it. It seems that the program has lost the value.
More information about the Python-list
mailing list