Re: Object Graph question

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Aug 24 2005 - 03:19:18 EDT

  • Next message: Øyvind Harboe: "Eclipse Cayenne plugin"

    Yeah, shared cache is an LRU map of fixed size and there is no entry
    timeout yet. We should definitely add timeout in the future. Note
    that it stores DataRows (map snapshots of database rows), not
    DataObjects. They are used for quick faulting of relationships and to
    build update queries.

    Automatic refreshing occurs every time any user runs a SelectQuery
    via a DataContext (unless "refreshingObjects" property is explicitly
    set to false). So as long as you don't keep your DataContexts around
    for too long, you'd generally get fresh data.

    As for manual refreshing, you can either do this periodically to
    remove ALL cached snapshots:

    DataDomain domain = context.getParentDataDomain();
    domain.getSharedSnapshotCache().clear();

    Or you can refresh certain known objects by running a SelectQuery via
    a DataContext. Such refresh will affect all other DataContexts.

    Andrus

    On Aug 23, 2005, at 7:55 PM, Gentry, Michael ((Contractor)) wrote:

    > I haven't looked into it in detail, but I've seen objects stay in
    > the cache for days (things I loaded on Friday were there the
    > following Monday). This actually confused me, so I turned the
    > cache off (I get fresh objects every time now -- my app is low
    > usage). I don't believe there is currently a cache timeout (like
    > in EOF) to trim out older objects, but that could be a useful feature.
    >
    > If an object isn't in the cache it will definitely have to hit the
    > DB to fetch it. As for your other questions, maybe someone else
    > more experienced with the cache can answer them.
    >
    > /dev/mrg
    >
    > -----Original Message-----
    > From: Neil Pierson [mailto:neil.pierso..mail.com]
    > Sent: Tuesday, August 23, 2005 11:49 AM
    > To: cayenne-use..bjectstyle.org
    > Subject: Object Graph question
    >
    > Just curious: Cayenne by default has a Max # of Objects in its
    > Cache Configuration of 10,000. How long do those objects remain
    > in the object graph and is there any mechanism to 'garbage collect'
    > stale objects that haven't been accessed in a while either manually
    > or automatically? What happens when the limit is exceeded? Does
    > every request for an object not in the cache always cause a
    > database hit?
    >
    > n.



    This archive was generated by hypermail 2.0.0 : Wed Aug 24 2005 - 03:19:26 EDT