I have defined this cache file with dogpile
[1]. But my problem is that when I invoke the key in different classes, it can't find the value. Eg, If I am running cache.Cache.save("mykey", 123)
in the main.py
, and during the execution I am retrieving the value in another module submodule.py
with cache.Cache.get("mykey")
, I can't retrieve the value. I get NoValue
. It seems that I am not creating a unique and global cache for all my program.
All the set
and get
to the cache are made by this module mycache.py
. Why this is happening?
[1] mycache.py
from dogpile.cache import make_region
region = make_region().configure('dogpile.cache.memory')
class Cache:
@staticmethod
def save(key, value):
region.set(key, value)
@staticmethod
def get(key):
return region.get(key)