Re: Preventing multiple submits

Andi Scharfstein <[email protected]> Thu, 17 Feb 2005 18:32:38 +0100
Newsgroups gmane.comp.apache.mod-ruby
Message-ID <[email protected]>
Hi,

> I don't have any ruby code for this, but I think it should be trivial to
> set up that each form contains a hidden "transaction id" which is a 
> simple random string of characters. When the form submits you store the
> transaction id in some LRU cache. When the user submits the form again,
> you peek at the LRU and check if you've seen this transcaction id 
> before - if you have then its a double submit.

That's what I thought, but where do I store the LRU cache? I gather
that memory is a bad idea since there may be multiple instances of
mod_ruby running, each with its own memory (although that might not be
a problem, I'm not very proficient there), but disk presents another
problem, in that undefined behaviour might occur when several users
want to submit data simultaneously. Again, I don't know that much
about this, so please correct me if I'm wrong (or haven't thought of
all the possibilities). Thanks!

-- 
Bye: Andi S.                          mailto:[email protected]