About storing inventory [possible inefficiency]

Post here your questions about the OpenSpace 2.x or notify bugs and suggestions.

Moderators: Lapo, Bax

gl0om
Posts: 54
Joined: 30 Mar 2010, 17:39

About storing inventory [possible inefficiency]

Postby gl0om » 16 Oct 2010, 11:12

As I understand loadInventoryData sends the whole inventory to user.
It's ok until there's not much items in inventory.
But what if we have 5000+ items and only a little part of them is required according to different situations? How the performance and traffic will be affected when the inventory is really so huge?
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 18 Oct 2010, 11:31

It's hard to test this condition, but you can easily avoid this: if you need a small portion of the inventory only, filter it. Check the IOpenSpace. loadInventory method description in the API.
Paolo Bax
The SmartFoxServer Team
gl0om
Posts: 54
Joined: 30 Mar 2010, 17:39

Postby gl0om » 18 Oct 2010, 12:57

Yep, I checked OpenSpace.loadInventory

As I understand loadInventory request calls server-side getInventoryItemsList if user's inventory already in cache. But if it isn't, loadInventory request calls server-side loadInventoryData and then, after all items are loaded and cached it calls getInventoryItemsList. So anyway loadInventory loads all inventory. Or am I wrong?
User avatar
Bax
Site Admin
Posts: 4522
Joined: 29 Mar 2005, 09:50
Location: Italy
Contact:

Postby Bax » 20 Oct 2010, 09:33

No, you are not wrong. But you could also override the extension's loadInventoryData, and retrieve a subset of inventory items from a DB for example.
Paolo Bax
The SmartFoxServer Team

Return to “OpenSpace v2 discussions and help”

Who is online

Users browsing this forum: No registered users and 2 guests