Raised This Month: $12 Target: $400
 3% 

Quick & Easy data storage?


Post New Thread Reply   
 
Thread Tools Display Modes
Author Message
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-17-2008 , 12:17   Quick & Easy data storage?
Reply With Quote #1

I'd like to learn more about various data storage methods in SourceMod. So I'd like to ask advice as to what method would work best for this scenario.

My menu based rules plugin displays rules in a panel automatically to connecting clients. I already have code established to prevent displaying rules to previously connected clients on map change. This currently is NOT using any type of permanent storage. It just tosses the connected steam id's into an array before the map changes, then only displays the menu to clients who are not in the array after the map change.

I would like to implement something along the lines of a "once a day" rules menu.

Example:

Client Connects
Client accepts rules
Steam ID is stored in...????? keygroup? sql-lite? along with a timestamp.
Client reconnects anytime during the same day, does not recieve the menu.
Client connects the following day, gets displayed the menu.

I am very familiar with SQL, so if sqllite is the best option, thats no problem. However using SQL for something like this seems like it would be overkill.

Basically, what's the most efficient method of storing an estimated ~500 rows of data?
__________________
XARIUS is offline
bl4nk
SourceMod Developer
Join Date: Jul 2007
Old 10-17-2008 , 19:46   Re: Quick & Easy data storage?
Reply With Quote #2

Just do it in an SQL database and have a script going running that deletes all of the rows at midnight each night.
bl4nk is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-17-2008 , 20:36   Re: Quick & Easy data storage?
Reply With Quote #3

Quote:
Originally Posted by bl4nk View Post
Just do it in an SQL database and have a script going running that deletes all of the rows at midnight each night.
To keep the plugin as self contained as possible, I think that when I store the steam id, I'll also store a timestamp for that steam id. When checking connecting clients steam id's, I'll just check to see if the previous timestamp is >= 24hrs (or some definable cvar)

That way there's no external scripts or anything people would need to run.

Would sqllite be sufficient for this type of db activity? I've never used it before, so I don't know anything about the performance aspects compared to a traditional SQL server.
__________________
XARIUS is offline
pRED*
Join Date: Dec 2006
Old 10-17-2008 , 22:25   Re: Quick & Easy data storage?
Reply With Quote #4

Clientprefs.inc?
pRED* is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-18-2008 , 09:24   Re: Quick & Easy data storage?
Reply With Quote #5

Quote:
Originally Posted by pRED* View Post
Clientprefs.inc?
Hmm.. couple questions on this. I just read thru the clientprefs.inc file from the snapshot. First I've heard of it (looks great btw)
  1. Are these essentially session only cookies or are they permanent by steamID somehow?
  2. If by steamID, are there any performance issues storing two cookies per client? (I need to store yes/no string and a timestamp)
  3. If permanent, how often does the database get trimmed of stale entries? I can see this growing to huge sizes over time.
  4. Have any example code? I didn't see anything on the Wiki about this except that it's SM 1.1.
This extension is quite nice. I hope many plugin authors retrofit their plugins to utilize this. It has great potential for giving sourcemod some polish to help everything seem less "pluginish" and more seamless.

X
__________________

Last edited by XARIUS; 10-18-2008 at 09:52.
XARIUS is offline
pRED*
Join Date: Dec 2006
Old 10-18-2008 , 15:58   Re: Quick & Easy data storage?
Reply With Quote #6

1) Clients prefs is backed by a SQL database (supports sqlite and mysql), so all data is permanent and stored by steamid.

2)No there should be no performance loss with extra values.

3) Values are already stored in the database with a timestamp, but theres no default method to automatically remove them after a time period. You could file a feature request for this, or implement your own method of handling these.
Most databases can handle massive numbers of data with no problems so I don't think the build up is an issue for most people.

4) Theres the clientprefs.sp plugin, a few in approved plugins (permamute among others) and will be probably be a wiki article before too long.
pRED* is offline
XARIUS
SourceMod Donor
Join Date: May 2008
Location: Atlanta, GA
Old 10-18-2008 , 16:47   Re: Quick & Easy data storage?
Reply With Quote #7

Quote:
Originally Posted by pRED* View Post
1) Clients prefs is backed by a SQL database (supports sqlite and mysql), so all data is permanent and stored by steamid.

2)No there should be no performance loss with extra values.

3) Values are already stored in the database with a timestamp, but theres no default method to automatically remove them after a time period. You could file a feature request for this, or implement your own method of handling these.
Most databases can handle massive numbers of data with no problems so I don't think the build up is an issue for most people.

4) Theres the clientprefs.sp plugin, a few in approved plugins (permamute among others) and will be probably be a wiki article before too long.
Cool, thanks much for the responses. I'll give it a shot and see what I come up with. =)
__________________
XARIUS 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 00:19.


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