• Post Reply Bookmark Topic Watch Topic
  • New Topic
programming forums Java Mobile Certification Databases Caching Books Engineering Micro Controllers OS Languages Paradigms IDEs Build Tools Frameworks Application Servers Open Source This Site Careers Other Pie Elite all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Tim Cooke
  • paul wheaton
  • Liutauras Vilda
  • Ron McLeod
Sheriffs:
  • Jeanne Boyarsky
  • Devaka Cooray
  • Paul Clapham
Saloon Keepers:
  • Scott Selikoff
  • Tim Holloway
  • Piet Souris
  • Mikalai Zaikin
  • Frits Walraven
Bartenders:
  • Stephan van Hulst
  • Carey Brown

java caching

 
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Hi Everybody,
Please explain me what is java caching and where we can implement it ?

Thanks and regards,
S
 
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Likes 2
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks for the reply ,
Is the PreparedStatement , resultSet internally use the caching mechanism here ?

regards,
S
 
Jesper de Jong
Java Cowboy
Posts: 16084
88
Android Scala IntelliJ IDE Spring Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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).
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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?


regards,
S
 
Marshal
Posts: 80064
410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
What does "only common" mean?
Can you read the numbers individually? If you can deal with the numbers individually and discard them after use, the memory will be cleared for re-use.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Yes Campbell Ritchie , you are write ,
I am doing the code that way , but the problem is , it is taking huge volatile memory to run .
Do you have any suggestion ?


 
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

s begri wrote:
Do you have any suggestion ?



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.
 
Campbell Ritchie
Marshal
Posts: 80064
410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
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.
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
Thanks again ,

Can I read a huge datafile part by part and compare with the second file ?

regards,
S
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

s begri wrote:Thanks again ,

Can I read a huge datafile part by part and compare with the second file ?

regards,
S



Possibly - but the Devil is in the detail but you have not given any. What do the files look like? What are you trying to compare?
 
S Majumder
Ranch Hand
Posts: 349
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
James Sabre ,

It's a .csv file ...
 
Campbell Ritchie
Marshal
Posts: 80064
410
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
. . . and what sort of numbers does it contain? How many are duplicated? Describe the problem, otherwise nobody will know what to suggest.
 
James Sabre
Ranch Hand
Posts: 781
Netbeans IDE Ubuntu Java
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator

s begri wrote:James Sabre ,

It's a .csv 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.

Bye
 
Sheriff
Posts: 22816
132
Eclipse IDE Spring Chrome Java Windows
  • Mark post as helpful
  • send pies
    Number of slices to send:
    Optional 'thank-you' note:
  • Quote
  • Report post to moderator
It's time for s begri to TellTheDetails.
 
Politics n. Poly "many" + ticks "blood sucking insects". Tiny ad:
Gift giving made easy with the permaculture playing cards
https://coderanch.com/t/777758/Gift-giving-easy-permaculture-playing
reply
    Bookmark Topic Watch Topic
  • New Topic