On 1/24/06, Peter Kropf <[EMAIL PROTECTED]> wrote:
> On 1/24/06, Simon Cross <[EMAIL PROTECTED]> wrote:
> > Hi Peter,
> >
> > I've recently investigated exactly the question you've asked.  The
> > answer I arrived at is:
> >
> > Setting cacheValues=False does exactly what the name suggests - it
> > prevents caching of the values (fields) associated with an object.  So
> > with cacheValues=False obj.value retrieves value from the database.
> > With cacheValues set to True, obj.value main simply returns a cached
> > value from the Python object.  Notably, cacheValues has no effect on
> > whether the objects themselves are retained in SQLObject's object
> > cache.  Explicitly removing an object from the object cache requires a
> > call to obj.expire().
> >
> > If there is a bug, it is that I would expect SQLObject's cache not to
> > grow indefinitely.  The reason it does is that the code to check the
> > cache size is only called when something attempts to *fetch* an object
> > from the cache.  If you're only creating objects (as I was) then
> > things are only added to the cache (never fetched) and the cache grows
> > indefinitely unless you manually expire objects.
>
> Glad to hear that's what you found. It's not quite what I expected but
> as long as I understand this, I can work around it when needed. For
> now, using .expire() when my code needs to deal with creating large
> numbers of objects will work fine. If I get a bit of time, I'll also
> poke at what it would take to patch SQLObject so that the cache size
> check is also called when objects are inserted into the cache.
>
> - Peter
>

Well this was annoying me enough to try and fix the problem. I've
uploaded a patch to:
https://sourceforge.net/tracker/index.php?func=detail&aid=1414091&group_id=74338&atid=540674
that should cause the cache to be cleaned up when new objects are created.

I'm not certain on the original design of the caching module and the
use of the cullCount variable. But in looking at how it's currenly
being used, no cache cleanup will ever happen. I'm assuming that
cullCount was meant to be incrimented and when it reaches
cullFrequency then the cache is to be culled. The patch also includes
that as a fix.

Any chance I can encourage someone else to review and try it? And if
acceptable, can someone merge it into svn?

Thanks!

- Peter


-------------------------------------------------------
This SF.net email is sponsored by: Splunk Inc. Do you grep through log files
for problems?  Stop!  Download the new AJAX search engine that makes
searching your log files as easy as surfing the  web.  DOWNLOAD SPLUNK!
http://sel.as-us.falkag.net/sel?cmd=lnk&kid3432&bid#0486&dat1642
_______________________________________________
sqlobject-discuss mailing list
[email protected]
https://lists.sourceforge.net/lists/listinfo/sqlobject-discuss

Reply via email to