The word cache is a common term that can mean many different things in different contexts. The general idea is that it's a small but quickly accessible place where data can be stored, so that data that is retrieved frequently can be accessed quickly.
For example, a database uses some of the RAM of a computer to cache part of the content of the database. The data in the cache can be accessed much more quickly than the data that's on disk.
Webservers store pages that are accessed often in a cache in RAM so that those pages don't have to be loaded from disk each time they are accessed.
A CPU has a small amount of very fast memory on the CPU itself, in which it caches data that is frequently used by the running application.
There is no common thing called "java caching". Ofcourse you can implement caches in Java, but how you would do that depends on what exactly you want to cache and for what purpose.
When you do a database query using a PreparedStatement and you read out the results from a ResultSet, then undoubtedly there will be some cache involved somewhere. The database will most likely hold all (or part) of the results in memory until you're done with them (by calling close() on the ResultSet). But it's really up to the implementation of the database and JDBC driver that you are using what it caches exactly and how (in other words, it's impossible to say in general how that cache would work in detail).
Joined: Jun 03, 2009
Thanks again .
I have one problem ,,
I have two huge files (each around 4GB ) & those files contains some random numbers .I want to take only common numbers and put into a 3rd file . I have no provision to increase the JVM size , how can I do this?
Read one file and place all the 'numbers' in a table in a database. Read the second file and check whether or not each number is in the database table. If it is then add it to another table.
This will required very little RAM.
Retired horse trader.
Note: double-underline links may be advertisements automatically added by this site and are probably not endorsed by me.
Joined: Oct 13, 2005
You mean you cn't deal with the numbers individually. So James Sabre's suggestion sounds the best so far. It is a lot easier to help (or to know we don't know what to do) if you give us fuller details.
Joined: Jun 03, 2009
Thanks again ,
Can I read a huge datafile part by part and compare with the second file ?
This is like getting blood out of a stone. I don't understand the OP's reluctance to give any details that might allow people to help him to decide how to process the files and I can't be bothered to keep pestering him for the details.