duplock

duplock — Provides a place to record that an action has been done, so it doesn't get done a second time later by a user accidentally double-clicking a single-click button in their browser. The idea is that the application should grab a write lock for both the table it's inserting into, and the duplock table. Then, check the duplock table for a duplicate. If it's already in there, unlock the tables and remember the dupid to tell the user (app should pretend it was the first time... don't show an error message!), or if it's not in there, put it in the table, and then put the resulting uniqueid from the table handler into the duplock table (as dupid). The duplock table is purged every hour or so of all locks older than an hour.

duplock

Column nameTypeNullDefaultDescription
realmenum('support','log','comment','payments')supportThe area of the site the lock is being provided for.
reidint unsigned0Realm ID. If you don't need it (most don't), use 0. Example: for comment realm, reid is the itemid being replied to.
useridint unsigned0The userid doing the action, or 0 if user is unknown (as in support realm)
digestchar(32)The md5 digest of the event. Concatenate everything important and run it through perl's md5_hex (or MySQL's md5)
dupidint unsigned0The unique ID this action generated the first time.
instimedatetime0000-00-00 00:00:00The time the action first completed.
Key nameTypeColumn(s)
instimeINDEX
realmINDEX