Author Topic: The best least-lag way of keeping client variables?  (Read 1055 times)

/title, because people will get mad if when they re-join they lose their money. But the way Iban's stores it's data causes some lag I've heard, unless that's the best you can get surely there's a better way?

Least lag or most efficient? The least lag way would be to use global variables (i.e. $YourModVars::Money[%BL_ID] = %client.money;). However, with thousands of clients joining and leaving that creates a lot of variables which is bad for performance. The best way to store lots of data is using file objects (tutorial here) but this takes a lot of time to save/load. The best option is to use a mix of these two where when a client connects if $YourModVars::Money[%BL_ID] doesn't exist, attempt to load it from a file. Then periodically (say, every 24 hours) run deleteVariables("$YourModVars::*"); so that you don't have thousands of those variables existing, only the ones for people who have already played that day.

-snip-

I guess I could try the first option, If not I'll go with the second, thanks!