Raised This Month: $ Target: $400
 0% 

Efficient key value storage


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
Nikkii
Member
Join Date: Feb 2012
Old 02-22-2012 , 22:29   Efficient key value storage
Reply With Quote #1

So I found a plugin a while ago that does exactly what I want, sort of...

It's simple-chatcolors, and I noticed that it loads the KeyValues file every check, which seems extremely inefficient, and probably could be cached.

The basics go like this...
Player connects, calls CheckPlayer, CheckPlayer then loads the file into a KeyValue handle, and loops through checking admin flags/etc, and finally creating a Trie from the data, and then setting the client index in a Handle to that trie data, which is then used when the player talks.

I'm in the process of rewriting this a bit, and thought it would be a bit better to store it in some kind of array based on group name (I will be removing the 'flag' checking system for some group name check), but I'm a little stuck with how to load the config once and then go back to the data...

I basically need to store the data in a Key Value map of some sort, with the key being the group name, and value being the already loaded Trie (No reason to reload, it is an extremely simple concept).

So, is there any data type that would let me do this efficiently? I don't want to have to go back and load everything every player connect/construct a new trie every connect...

Please note, the trie value will be reused and mapped to any player who connects (If it is not possible to reuse these, I could always clone them, please let me know), and unmapped from that player when they disconnect...

Any suggestions would help me greatly, I know plenty of other languages to fix any problems, however I am unfamiliar with the sourcemod scripting language and it's data types...
Nikkii is offline
Reply



Posting Rules
You may not post new threads
You may not post replies
You may not post attachments
You may not edit your posts

BB code is On
Smilies are On
[IMG] code is On
HTML code is Off

Forum Jump


All times are GMT -4. The time now is 13:48.


Powered by vBulletin®
Copyright ©2000 - 2024, vBulletin Solutions, Inc.
Theme made by Freecode