duplock

duplock — Global. Stores a 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). This table is purged every hour or so of all locks older than an hour.

duplock

Column name Type Null Default Description
realm enum('support','log','comment','payments')   support The area of the site the lock is being provided for.
reid int unsigned   0 Realm ID. If you don't need it (most don't), use 0. Example: for comment realm, reid is the itemid being replied to.
userid int unsigned   0 The userid doing the action, or 0 if user is unknown (as in support realm)
digest char(32)   The md5 digest of the event. Concatenate everything important and run it through perl's md5_hex (or MySQL's md5)
dupid int unsigned   0 The unique ID this action generated the first time.
instime datetime   0000-00-00 00:00:00 The time the action first completed.
Key name Type Column(s)
realm INDEX