• 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 all forums
this forum made possible by our volunteer staff, including ...
Marshals:
  • Campbell Ritchie
  • Ron McLeod
  • Paul Clapham
  • Bear Bibeault
  • Junilu Lacar
Sheriffs:
  • Jeanne Boyarsky
  • Tim Cooke
  • Henry Wong
Saloon Keepers:
  • Tim Moores
  • Stephan van Hulst
  • Tim Holloway
  • salvin francis
  • Frits Walraven
Bartenders:
  • Scott Selikoff
  • Piet Souris
  • Carey Brown

URlyBird v. 1.3.3 & caching

 
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
All of you who have done DB caching, how did you manage the part that some other program still reads/writes to same file?

1) Ignore it, use 100% caching, and try to explain in choises.txt (data is old and might be obsolete)
2) Make readcache and use observer design pattern to refresh it when writing. (somewhat possibility that data is old)
3) Don't use caching (possibility that data is old is minor)

?

Or i'm I just thinking too far?
 
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi Jari,

My instructions state:


You may assume that at any moment, at most one program is accessing the database file;



so one your program starts no other program is accessing the file to read/write
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roel De Nijs wrote:Hi Jari,

My instructions state:


You may assume that at any moment, at most one program is accessing the database file;



so one your program starts no other program is accessing the file to read/write



Ok. I was little unsure about that sentence... So it means, that no other program is accessing the file?
 
Roel De Nijs
Sheriff
Posts: 11604
178
Hibernate jQuery Eclipse IDE Spring MySQL Database AngularJS Tomcat Server Chrome Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
That is indeed my interpretation. if our program starts no other program will use the file during the run of our program.
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Oh yeah. Good. Then i'mm go with choise number 2)
 
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hello, Jari!

Just to give you a position, I used caching, that is, when the application starts, I place all records in memory, and when it finishes, I write them all back to the .db file. But I didn't use the observer pattern, because it isn't really necessary. What I did is, the records being displayed to the users are refreshed every time they call the server. For instance, if you have records 1, 2 and 3 being displayed, I update record 2, then you update record 3, then record 2 will be updated in your screen only when you update record 3.

Also, it is exactly what you guys are saying. It is only our application accessing the .db file. So, you can use caching without any problems and not worry about the file being updated out of your application and messing up the records!
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roberto Perillo wrote:Hello, Jari!

Just to give you a position, I used caching, that is, when the application starts, I place all records in memory, and when it finishes, I write them all back to the .db file. But I didn't use the observer pattern, because it isn't really necessary. What I did is, the records being displayed to the users are refreshed every time they call the server. For instance, if you have records 1, 2 and 3 being displayed, I update record 2, then you update record 3, then record 2 will be updated in your screen only when you update record 3.

Also, it is exactly what you guys are saying. It is only our application accessing the .db file. So, you can use caching without any problems and not worry about the file being updated out of your application and messing up the records!



Thanks for input. That's quite straght forward. This assignment is getting easier every minute

Did you white changed information or emptied whole file and wrote it according to schema?
 
Roberto Perillo
Bartender
Posts: 2292
3
Eclipse IDE Spring Java
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hummm not really, I don't erase the whole file. Since records are not physically deleted from the file, then I just write the records back, and the flags of the deleted records are updated accordingly.
 
Jari Timonen
Ranch Hand
Posts: 232
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator

Roberto Perillo wrote:Hummm not really, I don't erase the whole file. Since records are not physically deleted from the file, then I just write the records back, and the flags of the deleted records are updated accordingly.



Oh yeah, sorry. Forgot that gui does not have create button. Only Data-class.
 
It runs on an internal combustion engine. This ad does not:
the value of filler advertising in 2020
https://coderanch.com/t/730886/filler-advertising
reply
    Bookmark Topic Watch Topic
  • New Topic