Re: DataObjectUtils.objectForPK() caches- is there a way to not use the cache on this one?

From: Andrus Adamchik (andru..bjectstyle.org)
Date: Wed Dec 07 2005 - 02:42:27 EST

  • Next message: Andrus Adamchik: "Re: Moving 3 tier (ObjectContext problem)"

    Jürgen,

    Your broad remark has nothing to do with Joseph's question that has a
    simple and trivial solution. From this post and some other of your
    earlier posts, I think you misunderstood how caching works. You do
    realize that caching is not some inevitable evil, but simply another
    useful feature? You are free to turn it off.

    Good thing about Cayenne caching is that you can tweak what to cache
    and what to refresh, giving you the best performance in your specific
    situation, but you can always opt out of it all together. Here is a
    few tips that will hopefully clear the confusion:

    (1) SelectQuery with properly configured prefetches will go a long
    way in providing you with fresh objects on every request. This way
    you are in control of refreshing parts of the object graph.

    (2) Combine (1) with replacing a DataContext on every request (i.e.
    do not store DataContext in the session). Don't use DataObjectUtils
    for PK lookup (this is just a shortcut; you can use a SelectQuery
    that refreshes data).

    (3) If this is still not enough, you can configure Cayenne stack to
    avoid cache between multiple DataContexts. Simply uncheck "Use Shared
    Cache" checkbox for the DataDomain in the Modeler. See the first
    picture on this page for explanation:

    http://objectstyle.org/cayenne/userguide/design/caching.html

    Andrus

    On Dec 7, 2005, at 9:47 AM, Jürgen Saar wrote:
    > Caching is really a problem if there are
    > non-cayenne actions on the database.
    >
    > We are actually looking for alternatives to cayenne
    > because the trouble about caching
    > has become 'missing-critical'.
    > For our customer there is no acceptance for
    > seeing 'old' data in an actual requests.
    >
    > cayenne-use..bjectstyle.org schrieb am 06.12.05 21:50:51:
    >>
    >> Hi,
    >>
    >> I am refreshing an object I have loaded to update it if the DB has
    >> changed it while I am looking at it. I noticed that
    >> DataObjectUtils.objectForPK() is caching and I would like it not
    >> to, or
    >> find another way to get the object by id using a query. Any ideas?
    >>
    >> Thanks,
    >> Joseph
    >



    This archive was generated by hypermail 2.0.0 : Wed Dec 07 2005 - 02:42:31 EST