Lets make sure everyone is on the same page here. First the terms. IBATIS Cache == a collection of Resultsets Resultset == collection of rows from the executed query.
Like is has been said a few times ibatis caches resultsets. So here are some examples. Lets start with a query for People that takes a parameter of last name. Lets set the cache size to be 100. The first time you call it with a last name of Jones. Now your cache has 1 item in with all the results of your query for "Jones". This is one tip to the DB. Now you call it with "Smith". No you have 2 items in your cache. Round trip number two! Last but not least you call the first query one more time. Cache still has 2 items in it and you are still at a total of 2 DB trips. Sizing your cache is a person decision. This maybe something that needs adjusting over time. Find out what works for your app with your memory configuration. One good example might be a query for a User object after someone logs into your system. Lets say you have 10k users but only 500 are ever online at one time. You might want to set your Users cache to 500. This way the most active and most recent are in the cache if you are using a LRU cache. Hope this helps On Thu, Oct 22, 2009 at 7:37 AM, meindert <meind...@eduflex.com> wrote: > No, it would store a maximum of 100 result sets (with the complete result > of > the query) > (A result set is a list of objects equal to the list of rows returned from > the DB) > N.B. Your server might run into memory issues if each of those result sets > contains about 200 objects > The cache is only handy if you call the query with the same parameters > multiple times in your application > If you want paging you should check > > http://www.java-community.de/archives/86-Pagination-with-Apache-iBatis-SqlMa > ps.html > > > -----Original Message----- > From: Odelya YomTov [mailto:ode...@jpost.com] > Sent: 22 October 2009 03:26 PM > To: user-java@ibatis.apache.org > Subject: RE: caching question > > So if lets say the result could return 200 records, and the cacheModel size > is set for 100 - would it return only 100 results? Or the next time it > would > actually display only the 100 records and not 200? > > -----Original Message----- > From: meindert [mailto:meind...@eduflex.com] > Sent: Thursday, October 22, 2009 3:23 PM > To: user-java@ibatis.apache.org > Subject: RE: caching question > > >Do you mean that actually it invokes the database when I execute the > query? > No, only the first time, the next time you ask the same query with the same > parameters it will get the resultset from the cache > The cache size is the number of different result sets are stored in the > cache. > > So if you invoke the same query (with the same parameters) multiple times > it > only does one round trip. > This is handy for example if you have a query that is executed after a > logon. This same query is repeated every time a logon is done. So you could > put the result in a server level variable or you use the ibatis cache. > Another example would be a grid in your application that is requested by > multiple users (as long if it is requested with similar parameters) > > If you're result set size is 800000 records or if the query parameters are > different for every screen, ibatis caching is not for you, > > > > > > -----Original Message----- > From: Odelya YomTov [mailto:ode...@jpost.com] > Sent: 22 October 2009 03:05 PM > To: user-java@ibatis.apache.org > Subject: RE: caching question > > Do you mean that actually it invokes the database when I execute the query? > If so, what is the point of caching? > > -----Original Message----- > From: meindert [mailto:meind...@eduflex.com] > Sent: Thursday, October 22, 2009 3:01 PM > To: user-java@ibatis.apache.org > Subject: RE: caching question > > It's the result you cache not the query. How many different query result > would you like to cache > > > -----Original Message----- > From: Odelya YomTov [mailto:ode...@jpost.com] > Sent: 22 October 2009 02:29 PM > To: user-java@ibatis.apache.org > Subject: caching question > > Hi! > > I have a global question about caching. > > I have in my database around 800000 recrods > > In cacheModel - what do you recommend as the size of the cacheModel? > > I am using the query almost in every screen. > > Thanks > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.423 / Virus Database: 270.14.20/2444 - Release Date: 10/21/09 > 16:44:00 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > > > > > **************************************************************************** > ******** > This footnote confirms that this email message has been scanned by > PineApp Mail-SeCure for the presence of malicious code, vandals & computer > viruses. > > **************************************************************************** > ******** > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.423 / Virus Database: 270.14.20/2444 - Release Date: 10/21/09 > 16:44:00 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > > > > > **************************************************************************** > ******** > This footnote confirms that this email message has been scanned by > PineApp Mail-SeCure for the presence of malicious code, vandals & computer > viruses. > > **************************************************************************** > ******** > > > > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > > > No virus found in this incoming message. > Checked by AVG - www.avg.com > Version: 8.5.423 / Virus Database: 270.14.20/2444 - Release Date: 10/21/09 > 16:44:00 > > > --------------------------------------------------------------------- > To unsubscribe, e-mail: user-java-unsubscr...@ibatis.apache.org > For additional commands, e-mail: user-java-h...@ibatis.apache.org > >