Re: load balancing and SQLObject cache

Oleg Broytman <[email protected]>
Newsgroups gmane.comp.python.sqlobject
Message-ID <[email protected]>
On Tue, Jul 19, 2011 at 09:39:55AM -0300, Егор Следов wrote:
> It does not seem to work. When I set cache to 0 and debug to 1 in uri
> 
> DB URI ('postgres://host/db?cache=0&debug=1')
> 
> f = db.Person.get(5)
> print f.name
> f1 = db.Person.get(5)
> print f1.name
> 
> I don't see second select to the database on second get.
> Apparently, the value is fetched from expiredCache.
> 
> Any suggestions?
> 
> Thank you.

   Expired cache stores weak references. I.e. while the program is
holding a (non-weak) reference to a row the cache will return the same
row. The moment you free the last reference to the row the expired cache
is cleared and next time you will get a new row.
   Get rid of f before getting f1:
del f
   or
f = None
   will do.

Oleg.
-- 
     Oleg Broytman            http://phdru.name/            [email protected]
           Programmers don't die, they just GOSUB without RETURN.

------------------------------------------------------------------------------
Magic Quadrant for Content-Aware Data Loss Prevention
Research study explores the data loss prevention market. Includes in-depth
analysis on the changes within the DLP market, and the criteria used to
evaluate the strengths and weaknesses of these DLP solutions.
http://www.accelacomm.com/jaw/sfnl/114/51385063/
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.