This week's book giveaway is in the Agile and other Processes forum.
We're giving away four copies of The Mikado Method and have Ola Ellnestam and Daniel Brolund on-line!
See this thread for details.
The moose likes Developer Certification (SCJD/OCMJD) and the fly likes Record cache question Big Moose Saloon
  Search | Java FAQ | Recent Topics
Register / Login


Win a copy of The Mikado Method this week in the Agile and other Processes forum!
JavaRanch » Java Forums » Certification » Developer Certification (SCJD/OCMJD)
Reply Bookmark "Record cache question" Watch "Record cache question" New topic
Author

Record cache question

Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

Here is the new thread Roel

The question is to mainly Roel and Roberto, since they mentioned that they implemented a record cache with writing to the file when application finished.

How did you guys handle application crashes if you only wrote to the file when application finished? I was thinking of implementing a record cache myself, but then I thought it would add unnecessary complexity because there would be many issues to deal with.


Personal page, SCJP 6 with 91%, SCWCD 5 with 84%, OCMJD
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4355

I believe there are more people than just the 2 of us who implemented a record cache

I didn't have handled an application crash in my code. But in my choices.txt I mentioned this as one of the drawbacks of the approach, and I suggested a set of possible solutions to cope with an application crash (or a disk going out of space), but without any implementation (so no extra code was written)


SCJA, SCJP (1.4 | 5.0 | 6.0), SCJD
http://www.javaroe.be/
Elchin Asgarli
Ranch Hand

Joined: Mar 08, 2010
Posts: 222

Roel De Nijs wrote:I believe there are more people than just the 2 of us who implemented a record cache

I didn't have handled an application crash in my code. But in my choices.txt I mentioned this as one of the drawbacks of the approach, and I suggested a set of possible solutions to cope with an application crash (or a disk going out of space), but without any implementation (so no extra code was written)


I am currently thinking of not implementing it with the following reasoning:

That seems a bit error-prone to me, and in addition I am not sure whether it is a good idea to keep ALL of the records in memory, what is the point of having a database then? We don't have a lot of data in current database, but if application is to be enlarged, keeping all records can kill the application. And implementing advanced caching algorithms I think will add complexity.

Is this good enough reasoning to include in choices.txt? I will also include a location where to put the caching code if it is to be implemented.
Roel De Nijs
Bartender

Joined: Jul 19, 2004
Posts: 4355

Elchin Asgarli wrote:Is this good enough reasoning to include in choices.txt? I will also include a location where to put the caching code if it is to be implemented.

You can certainly add that in your decisions document.

And the lack of memory with huge database files, I addressed too in my choices.txt And why using a record cache instead of a database file: you can access memory a lot faster than file I/O.
 
I agree. Here's the link: http://ej-technologies/jprofiler - if it wasn't for jprofiler, we would need to run our stuff on 16 servers instead of 3.
 
subject: Record cache question
 
Similar Threads
Dealing with Deleted Records
record cache
URLyBird question regarding db method
URLyBird GUI start up how to get all Rooms?
Starting OCMJD