Re: Object SelectQuery & Modeller

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Jun 23 2004 - 11:05:37 EDT

  • Next message: Sako!: "connect msSQL"

    On Jun 23, 2004, at 1:37 AM, Gary Jarrel wrote:
    > If I use the Modeller to set up the cached objects say ComponentGroup
    > and
    > place it into Shared Cache does that mean that once created this
    > object will
    > never be refreshed again until the server is restarted for example or
    > a call
    > to context.performQuery("ComponentGroup", true) is made.

    This is true (we will eventually implement an expiring cache - I am
    still looking for a reliable and lightweight expiring map
    implementation). Good news is that refreshing of shared cache can be
    done from *any* DataContext, so you can keep your maintenance thread
    around and refresh Cayenne cache when needed. Or instead of rerunning
    the query, you can do something like:

          
    dataContext.getObjectStore().getDataRowCache().cacheSnapshots("Component
    Group", null);

    This removes the cached entry for your query (I guess we should provide
    a better named method to do the cleanup).

    > The other alternative, is to place it into DataContext cache, which to
    > me
    > means that when a new DataContext is created a new instance of
    > ComponentGroup is created with the groups retrieved from the database.

    Depending on your usage patterns this may be a good solution too. For
    one thing access to the local cache is faster after the fetch is done,
    as there is no thread contention possibility and also since it stores
    DataObjects, not DataRows, so there is no extra conversion step.

    > Alternatively does the caching process take place on the first call to
    > context.performQuery("ComponentGroup", false)?

    Yes, if the query is configured to cache its results.

    Andrus



    This archive was generated by hypermail 2.0.0 : Wed Jun 23 2004 - 11:05:43 EDT