This week's book giveaway is in the Design forum.
We're giving away four copies of Design for the Mind and have Victor S. Yocco on-line!
See this thread for details.
Win a copy of Design for the Mind this week in the Design forum!
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic

How can I save temporary data in Server?

 
Cainiao Zou
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Hi all,
I need to save some data in server and share to many users. I cannot save them in cookie, session. because they are in client and cannot be shared to each other. The only methed I found is save them to database, but for some temporary and often changed data that may be a bad idea. Can I just save them in the memory of Server?

Thanks
 
Nishan Patel
Ranch Hand
Posts: 689
Eclipse IDE Java Scala
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Can I just save them in the memory of Server?


how can you save data into memory of Server?

I think database is the best way to share to many users.

Or

you can write data into file also and share to many users. But i think database is best way to perform this.
 
Vijitha Kumara
Bartender
Posts: 3913
9
Chrome Fedora Hibernate
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What kind of data are this? Is it possible to use ServletContext if data are not that huge ?
 
Cainiao Zou
Ranch Hand
Posts: 36
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
first of all, thanks to your reply.

I want to make a ajax-based card web game, there are many temporary data, like how much life left, how much mana left, which card he has... for every action of the user I need to update the database. it's like every second for each online user one update on database! So I just thinking about other method. I think for the traditional online game, which connects with UDP/TCP, they have no such problem, they just save them in memory, right?
 
Ankit Garg
Sheriff
Posts: 9510
22
Android Google Web Toolkit Hibernate IntelliJ IDE Java Spring
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
"roo kie" please check your private messages for some administrative matter.
 
Bosun Bello
Ranch Hand
Posts: 1510
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Look into the ServletContext, and see if that will serve your needs.
 
kirans reddy
Greenhorn
Posts: 15
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
Use File.createTempFile
 
Lorenz Baylon
Ranch Hand
Posts: 99
  • Mark post as helpful
  • send pies
  • Quote
  • Report post to moderator
What if you save them as properties of a singleton object, since if I'm not mistaken, the data that you need to save are read-only to the users.
 
  • Post Reply
  • Bookmark Topic Watch Topic
  • New Topic