Re: caching of query results

From: Bryan Lewis (brya..aine.rr.com)
Date: Fri Jan 28 2005 - 13:50:02 EST

  • Next message: Gentry, Michael \(Contractor\): "RE: caching of query results"

    MessageThanks for the tip. I'm going to use only the local per-data-context caching. If I have to change some of our mostly-constant "reference data" behind the scenes, the worst case is, all the users will get the new data the next time they log in. Somebody stop me if that doesn't make sense. :-)

    Our users will be happy with this. In our old WebObjects Objective-C apps, the users wouldn't see a change to reference data until the app was restarted. We do an automatic restart every day in the wee hours for that reason. Well, that plus the fact that the apps leaked memory badly. The new Java apps are going to be so much nicer.
      
      ----- Original Message -----
      From: Gentry, Michael (Contractor)
      To: cayenne-use..bjectstyle.org
      Sent: Friday, January 28, 2005 12:43 PM
      Subject: RE: caching of query results

      Hey Bryan (and others), one thing that "bit" me about the caching is that it is too damned good! Be aware that things will live in your cache for potentially long periods of time. I was doing caching in a utility app and went home over the weekend. Came back, accessed it again, and was getting data from the previous week, even though things had changed over the weekend as our jobs were running. I guess I was expecting them to timeout or something, but as long as they don't get pushed out of the cache, they stay alive.

      Just keep that in mind.

      /dev/mrg

        -----Original Message-----
        From: Bryan Lewis [mailto:brya..aine.rr.com]
        Sent: Friday, January 28, 2005 11:42 AM
        To: cayenne-use..bjectstyle.org
        Subject: Re: caching of query results

        Okay, it's working now. This way works (as in the user's guide):

            // Starting with a named query...
            query.setRefreshingObjects(boolean refresh);
            headlines = dc.performQuery(query);

        What I was doing the first time didn't work:

            DataMap theMap = (DataMap) dc.getDataMaps().iterator().next();
            theMap.addQuery(query);
            headlines = dc.performQuery(queryName, refresh);

        Somewhere I got the idea I was supposed to be using the second version of performQuery(), which wants the query to be stored in the DataMap. I guess one shouldn't try to use that except with queries that were created in the modeler GUI.

        Thanks! This feature is going to be very useful.



    This archive was generated by hypermail 2.0.0 : Fri Jan 28 2005 - 13:50:06 EST