I am puzzled. Let me think about this.

Massimo

On Jan 4, 2:47 am, David Zejda <d...@atlas.cz> wrote:
> -----BEGIN PGP SIGNED MESSAGE-----
> Hash: SHA1
>
> Hi :)
>
> Yes, I am really sure. This is exact code of my controller.
>
> def load_pers():
>
>     class Blah():
>         def __init__(self):
>             pass
>
>     def blah2():
>         return Blah()
>
>     p = cache.ram('blahblah',blah2,time_expire=30)
>
>     return dict(p=BEAUTIFY(p))
>
> and this has the same effect:
>
> def load_pers():
>
>     class Blah():
>         def __init__(self):
>             pass
>
>     p = cache.ram('blahblah',Blah,time_expire=30)
>
>     return dict(p=BEAUTIFY(p))
>
> Simply, if I store an object declared in controller or model in cache
> (regardless of db involvement), whole db model is being duplicated in
> RAM, which is really unwanted behaviour.
>
> As I mentioned in one of previous messages, I have strong suspiction
> that the issue is related to another one discussed here:
>
> http://www.mail-archive.com/web2py@googlegroups.com/msg34333.html
>
> D.
>
>
>
> mdipierro wrote:
> > Sorry. I got confused too. You say this leads to the leak:
>
> >     class Blah():
> >         def __init__(self):
> >             pass
> >     def blah2():
> >         return Blah()
> >     p = cache.ram('blahblah',blah2,time_expire=30)
>
> > so there is o db involved? Are you sure 'blahblah' is a constant in
> > your code and not a variable? Is this the exact code you are running?
>
> > On Jan 3, 5:42 pm, David Zejda <d...@atlas.cz> wrote:
> > Hello Massimo,
>
> > sorry, but I really do not understand. :-|
>
> > How do I store whole record if the only thing I'm trying to store is
> > instance of a dummy class? In the last example with empty __init__ there
> > is no record involved at all!
>
> > If I do exactly what Michele suggested:
>
> > class Blah():
> >     def __init__(self):
> >         self.nick = db.person[1].nick
>
> > def blah_f():
> >     return Blah()
>
> > p = cache.ram('blahblah', blah_f,time_expire=30)
>
> > result is the same, of course.
>
> > David
>
> - --
> David Zejda, Open-IT cz
> web development & serviceshttp://www.o-it.info
> -----BEGIN PGP SIGNATURE-----
> Version: GnuPG v1.4.9 (GNU/Linux)
> Comment: Using GnuPG with Mozilla -http://enigmail.mozdev.org
>
> iEYEARECAAYFAk0i3rUACgkQ3oCkkciamVEz2wCdGXIgszz1wjDCR6/gHMOSqpda
> T+QAnjbShkt47zF8D1NLzrjm0zrXEyTL
> =88aY
> -----END PGP SIGNATURE-----

Reply via email to