Le Tue, 8 May 2012 16:04:28 +0200,
Cédric Krier <[email protected]> a écrit :
> > So the idea will be to have an automatic clear of the cache when
> > entering in a new method because inside a method the developper can
> > now when to reset or not the cache.
> > To do that, we thought about using `inspect` to retreive the stack
> > and storing it in the local cache with the field value. Like that
> > when we retrieve value from the cache, if the stack is not the same
> > than we clear the cache.
> > The main issue with this design is that inspect.currentframe [1]
> > may not exist on other Python implementation. So the fallback will
> > be to clear the cache anyway.
> > 
> > So what do you think?
> > Is there anybody with a better idea?
> 
> I had a better idea :-)
> Instead of using the stack, I propose to add a counter on the
> Transaction that will count the create, write and delete calls.
> So on the instance when filling the local cache, this counter will be
> stored. Later when accessing the cache, the Transaction counter will
> be compared to the instance one and if they are different, the local
> cache is cleared.
> I think it is a cleaner way to fix the issue.

+1

"If the implementation is easy to explain, it may be a good idea."



-- 

Bertrand Chenal

B2CK SPRL
Rue de Rotterdam, 4
4000 Liège
Belgium
Email: [email protected]
Website: http://www.b2ck.com/

-- 
[email protected] mailing list

Reply via email to