On Tue, Nov 15, 2011 at 2:00 AM, Michael Toomim wrote:
> (Massimo, I'm not sure what the problem is you're referring to with
> creating an instance before I cache.)
>
Cache expects a callable object, instances are not callable, they have to
be called inside cache logic.
--
Bruno Rocha
[http
So let me tease these problems apart.
1. Some objects are not pickleable. These cannot be cached to disk.
2. If the object's class is not defined in the scope available to
gluon/cache.py, then the object cannot be unpickled.
Both of these problems can be avoided by using cache.ram. (That's what
I
Even if they are pickable. it is possible that they get pickled but
web2py cannot unpickle them.
On Nov 14, 9:10 pm, Bruno Rocha wrote:
> I notice that if you are planning to run on GAE, your cached object needs
> to be Pickable, in my case, the config object instance is a king of
> Storage, whic
I notice that if you are planning to run on GAE, your cached object needs
to be Pickable, in my case, the config object instance is a king of
Storage, which acts like a dict.
So follow what Massimo said, and store only dict like objects in GAE,
otherwise you will heve this issue:
PicklingError:
I am caching my configuration class, I am passing the class to cache.ram()
and it will be called to create a new instance, and the instance will be
cached.
/modules/config.py
class Config():
> def __init__(self, db):
> # inside config I use cache to read config from db and sometimes
there are two problems:
you are creating the instance before you cache, so the caching does
nothing (would do nothing if it worked). It does not work because it
cannot be serialized since Blah is not defined in a module but in a
model/controller. You will avoid lots of headaches if you cache
dictio
6 matches
Mail list logo