Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]


Groups > comp.lang.python > #100963

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

Path csiph.com!fu-berlin.de!uni-berlin.de!not-for-mail
From Peter Otten <__peter__@web.de>
Newsgroups comp.lang.python
Subject Re: Cannot get the value from dogpile.cache from different modules.
Date Tue, 29 Dec 2015 18:33:18 +0100
Organization None
Lines 46
Message-ID <mailman.56.1451410408.11925.python-list@python.org> (permalink)
References <7c8df879-b03a-4323-90c5-3221dd1eced2@googlegroups.com> <e94e9346-cccd-44cb-b889-75c308921555@googlegroups.com> <mailman.54.1451405867.11925.python-list@python.org> <10871dc8-ee11-41d8-ad3c-c0aab267be64@googlegroups.com>
Mime-Version 1.0
Content-Type text/plain; charset="ISO-8859-1"
Content-Transfer-Encoding 7Bit
X-Trace news.uni-berlin.de rzBzit6hInnD/+2YiEgNzwLYfGUROESAFh0rB7uGABaA==
Return-Path <python-python-list@m.gmane.org>
X-Original-To python-list@python.org
Delivered-To python-list@mail.python.org
X-Spam-Status OK 0.001
X-Spam-Evidence '*H*': 1.00; '*S*': 0.00; 'cache': 0.05; 'modified': 0.05; '"no"': 0.07; 'implements': 0.07; 'dict': 0.09; 'here?': 0.09; 'received:80.91': 0.09; 'received:80.91.229': 0.09; 'received:gmane.org': 0.09; 'received:list': 0.09; 'python': 0.10; 'backend': 0.15; 'value.': 0.15; '[2].': 0.16; 'mailinglist': 0.16; 'modules,': 0.16; 'nest': 0.16; 'received:80.91.229.3': 0.16; 'received:dip0.t-ipconnect.de': 0.16; 'received:io': 0.16; 'received:plane.gmane.org': 0.16; 'received:psf.io': 0.16; 'received:t-ipconnect.de': 0.16; 'utc,': 0.16; 'wrote:': 0.16; 'memory': 0.17; 'skip:` 10': 0.18; 'skip:` 20': 0.18; 'tells': 0.18; 'variable': 0.18; 'versions': 0.20; '2015': 0.20; 'seems': 0.23; 'script': 0.25; 'header:User-Agent:1': 0.26; 'example': 0.26; 'header:X-Complaints-To:1': 0.26; 'sense': 0.26; 'skip:" 20': 0.26; 'subject:skip:d 10': 0.27; 'wraps': 0.29; 'that.': 0.30; 'code': 0.30; 'minimal': 0.30; 'probably': 0.31; 'post': 0.31; 'another': 0.32; "can't": 0.32; 'december': 0.32; 'run': 0.33; 'problem': 0.33; 'that,': 0.34; 'library.': 0.35; 'but': 0.36; 'should': 0.36; 'modules': 0.36; 'skip:m 40': 0.36; 'to:addr :python-list': 0.36; 'subject:: ': 0.37; 'two': 0.37; 'received:org': 0.37; 'mean': 0.38; 'why': 0.39; 'data': 0.39; 'does': 0.39; 'subject:from': 0.39; 'subject:the': 0.39; 'easily': 0.39; 'rather': 0.39; 'to:addr:python.org': 0.40; 'received:de': 0.40; 'your': 0.60; 'skip:u 10': 0.61; 'reach': 0.61; 'no.': 0.62; 'spot': 0.63; 'different': 0.63; 'between': 0.65; 'accessed': 0.66; 'here': 0.66; 'subject:get': 0.81; 'ball,': 0.84; 'otten': 0.84; 'subject:value': 0.84; 'forgotten': 0.91
X-Injected-Via-Gmane http://gmane.org/
X-Gmane-NNTP-Posting-Host p57bd90e9.dip0.t-ipconnect.de
User-Agent KNode/4.13.3
X-BeenThere python-list@python.org
X-Mailman-Version 2.1.20+
Precedence list
List-Id General discussion list for the Python programming language <python-list.python.org>
List-Unsubscribe <https://mail.python.org/mailman/options/python-list>, <mailto:python-list-request@python.org?subject=unsubscribe>
List-Archive <http://mail.python.org/pipermail/python-list/>
List-Post <mailto:python-list@python.org>
List-Help <mailto:python-list-request@python.org?subject=help>
List-Subscribe <https://mail.python.org/mailman/listinfo/python-list>, <mailto:python-list-request@python.org?subject=subscribe>
Xref csiph.com comp.lang.python:100963

Show key headers only | View raw


xeon Mailinglist wrote:

> 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. 

Does "No" mean "I have run my code with another backend, and the modified 
script showed the same behaviour"?

> 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.

I can't make sense of that. You should be able to nest methods to your 
heart's content (as long as you don't reach the recursion limit).

Can you post minimal versions of your modules in such a way that I can 
easily run them over here? 

If you have only one process you probably have somehow managed to get two 
backend dicts. Unfortunately there's a blind spot on my crystal ball, and I 
can't see how exactly you did it...

Back to comp.lang.python | Previous | NextPrevious in thread | Next in thread | Find similar | Unroll thread


Thread

Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 03:15 -0800
  Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 07:20 -0800
    Re: Cannot get the value from dogpile.cache from different modules. Peter Otten <__peter__@web.de> - 2015-12-29 17:17 +0100
      Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:13 -0800
        Re: Cannot get the value from dogpile.cache from different modules. Peter Otten <__peter__@web.de> - 2015-12-29 18:33 +0100
          Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:38 -0800
            Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 10:22 -0800
            Re: Cannot get the value from dogpile.cache from different modules. Peter Otten <__peter__@web.de> - 2015-12-29 20:11 +0100
    Re: Cannot get the value from dogpile.cache from different modules. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 17:14 +0000
      Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:23 -0800
      Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 09:27 -0800
        Re: Cannot get the value from dogpile.cache from different modules. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 19:22 +0000
          Re: Cannot get the value from dogpile.cache from different modules. xeon Mailinglist <xeonmailinglist@gmail.com> - 2015-12-29 14:57 -0800
            Re: Cannot get the value from dogpile.cache from different modules. Mark Lawrence <breamoreboy@yahoo.co.uk> - 2015-12-29 23:30 +0000
        Re: Cannot get the value from dogpile.cache from different modules. Dennis Lee Bieber <wlfraed@ix.netcom.com> - 2015-12-29 17:49 -0500

csiph-web