[Question] Item information storage

01/20/2014 22:40 littlechris95#1
Which is better and why?

1 - Store all the information of the items in a dictionary own project as well as most sources do?

2 - Store the information of items in the database and do a search in the database each time the information is requested for an item?
01/20/2014 22:56 Aceking#2
Store all the information in the database.
And then store all CURRENTLY used items in variables while the player is online.
01/21/2014 14:34 littlechris95#3
Quote:
Originally Posted by Aceking View Post
Store all the information in the database.
And then store all CURRENTLY used items in variables while the player is online.
Thanks for your opinion

- Anymore?
01/21/2014 14:58 Y u k i#4
Well... im a friend of the "lets put everything into ram" philosophy :D

Items arent big data, so you could always store evereything in memory and save time on access / IO locks.

Ram is cheap, efficient programming means using the ressources you have available. If you need to keep the ressource usage down, go with ace´s way. His way sounds very good to me but its harder to implement :)

Good luck!
01/21/2014 16:03 littlechris95#5
Quote:
Originally Posted by Y u k i View Post
Well... im a friend of the "lets put everything into ram" philosophy :D

Items arent big data, so you could always store evereything in memory and save time on access / IO locks.

Ram is cheap, efficient programming means using the ressources you have available. If you need to keep the ressource usage down, go with ace´s way. His way sounds very good to me but its harder to implement :)

Good luck!
Thank you very much!

#Closed
01/21/2014 17:21 Aceking#6
Quote:
Originally Posted by Y u k i View Post
Well... im a friend of the "lets put everything into ram" philosophy :D

Items arent big data, so you could always store evereything in memory and save time on access / IO locks.

Ram is cheap, efficient programming means using the ressources you have available. If you need to keep the ressource usage down, go with ace´s way. His way sounds very good to me but its harder to implement :)

Good luck!
So you would load every item upon server start?
Not saying its a bad way just curious.

And it isn't really hard to implement.
Upon player login, just fill a dictionary with all that players items from the database. Then you just need to save it back whenever there are changes.
This way also ensures there is minimal data loss in the event of a crash.

If the server crashes or power fails and all that data in the RAM isn't saved, then its gone.
01/21/2014 17:56 littlechris95#7
Quote:
Originally Posted by Aceking View Post
So you would load every item upon server start?
Not saying its a bad way just curious.

And it isn't really hard to implement.
Upon player login, just fill a dictionary with all that players items from the database. Then you just need to save it back whenever there are changes.
This way also ensures there is minimal data loss in the event of a crash.

If the server crashes or power fails and all that data in the RAM isn't saved, then its gone.
Excuse me, I forgot to mention. But I'm wondering about the information of all items (ItemType) and not the information of the items players.
01/21/2014 20:22 Aceking#8
Oh, I would definitely say database.