[storm] why weakrefdict for cache?

Richard Boulton richard at tartarus.org
Fri Aug 31 15:31:32 BST 2007


Bernd Dorn wrote:
> imho the memory consumption problem could be handled with explicit 
> deallocation of objects

Well, it probably _could_ be, but that would require a lot of extra
work.  If you want to keep copies of all objects returned by your
request in memory, you can implement a simple cache of your own (above
storm) to do that, but that's not the purpose of the cache in storm.

> that's a god point ... even though i am not sure in which use-case one 
> should store an object in memory which may magically change its values 
> without getting the object from a specific place again explicitly

It's not magically changing - the object represents some values in the
database, and it changes when a change is made to the values in the
database.  Since there is only one instance of the values in the
database, there should only be one instance of the object in memory.

-- 
Richard



More information about the storm mailing list