I want to cache the resultset information got by executing a query "Query1". Now when i exceute "Query1" again i want to read from the cache instaed of making a database call again. Do i have to do this explicitly in my application where-in i check in the cache for data if not found then i query the Database or this process is done implicitly. In either case, explicit or implicit loading,the cache can only serve the purpose only if the "Query1 " is exceuted for the 2nd time if not, my cache is useless (Hope iam correct). So what is the better way of doing things and when to go for cache (Will it be helpful in this scenario ??)
Hi Babu, I don't know what databases you are planning on working with (since I saw no mention of that in your post), but I know that this is the default behaviour with the Oracle database that I work with (version 126.96.36.199 on SUN [sparc] Solaris 7). The database has a cache where it keeps query results. So the second time you execute the same query, if the results are still in the database cache, then the data in the cache is what is returned. I would imagine that other databases behave the same way. So why would you want to implement this behaviour yourself? Even if you insisted on implementing this behaviour yourself, my guess is that the database's implementation is probably much better than what yours would be -- don't you think? Hope this has helped you. Good Luck, Avi.