For some methods/properties on a model it might be useful to memoize its 
result.
There are some common decoratos such as cached_property from werkzeug which 
simply add the
value to the object's __dict__ after retrieving it the first time (thus not 
calling the property's getter again).
Or you might end up using custom memoization code that stores the value 
somewhere on the object.

Anyway, the problem with all those things is that I'm likely to cache 
things too long in case they depend
on a column/relationship value since expiring the object won't expire my 
cached data.

Is there any place where I could store custom data associated with an 
instance of a mapped object that
is cleared when the object is expired?

-- 
You received this message because you are subscribed to the Google Groups 
"sqlalchemy" group.
To unsubscribe from this group and stop receiving emails from it, send an email 
to sqlalchemy+unsubscr...@googlegroups.com.
To post to this group, send email to sqlalchemy@googlegroups.com.
Visit this group at http://groups.google.com/group/sqlalchemy.
For more options, visit https://groups.google.com/d/optout.

Reply via email to