Let me clarify. Access stack structure we are talking about is shown
on this picture:
http://objectstyle.org/cayenne/images/userguide/cache-level2.gif
DataRowStore scope is normally the entire application. It is shared
by multiple sessions and outlives most of them. Its max object size
is managed by Cayenne using the hint set in the Modeler.
DataContext has its own second-level local cache (ObjectStore).
ObjectStore has no upper limit on the number of entries and hence can
potentially grow indefinitely. By design it is responsibility of a
user to avoid that, still in most cases you simply wouldn't care as
each individual session doesn't have too many objects and has a
limited life-span.
In cases when you do (e.g. batch processing described by Jürgen), one
strategy to deal with this is to replace session DataContext with a
new instance when it grows too big. Another one was described in a
quoted message. Essentially it is a common-sense decision based on
your usage pattern.
Andrus
On Nov 6, 2005, at 5:30 AM, Bryan Lewis wrote:
> I can't say what the problem was there. I do believe it was an
> overstatement to say that a DataContext grows without bound; the
> source code
> shows that the DataRowStore uses an
> org.apache.commons.collections.map.LRUMap. Of course I could be
> wrong or
> there might be a bug. (Something's not making sense here... the
> default
> cache size of 10,000 objects shouldn't consume more than a few
> megabytes.)
>
>
> ----- Original Message -----
> From: "Oscar Picasso" <oscgoogl..ahoo.com>
> To: <cayenne-use..bjectstyle.org>
> Sent: Saturday, November 05, 2005 5:55 PM
> Subject: Re: Cayenne, Tapestry and DataContext
>
>
>
>> So I guess the remark in this post
>> http://objectstyle.org/cayenne/lists/cayenne-user/
>> 2005/10/0120.html is not
>> correct and I can reuse the same DataContext?
>>
>> Oscar
>>
>> PS: Korbinian, did you try to set the Max number of Objects in the
>> "Cache
>> Configuration" instead of creating a new context?
>>
>> --- Bryan Lewis <brya..aine.rr.com> wrote:
>>
>>
>>> Of course Cayenne doesn't keep using memory without limit. If you
>>> look
>>>
> in
>
>>> the project properties in the modeler, you'll see a section "Cache
>>> Configuration" where you can specify the Max. Number of Objects.
>>>
This archive was generated by hypermail 2.0.0 : Mon Nov 07 2005 - 00:41:06 EST