[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [cgiapp] RFC2: CGI::Application::Plugin::RateLimit


On 5/3/06, Sam Tregar <suppressed> wrote:
     # keep people from calling 'send' more often than 5 times in 10
     # minutes and 'list' more often than once every 5 seconds.
     $rate_limit->protected_modes(send => {timeframe => '10m',
                                           max_hits  => 5
                                          },
                                  list => {timeframe => '5s',
                                           max_hits  => 1
                                          });

Nothing that is needed for a first version, but as an alternative to
'protected_modes' it might be nice to also allow that info to be
provided in an attribute.  It keeps the information close to where it
is actually applied:

sub send :RateLimit(max_hits=5, timeframe=10s) {
 my $self = shift;
 ...
}

We've been talking on IRC about providing better support for
attributes in CGI::Application, which can be tricky to get right when
lots of plugins are providing attributes.

Other than that suggestion, this plugin looks well thought out and useful.

Cheers,

Cees

---------------------------------------------------------------------
Web Archive:  http://www.mail-archive.com/suppressed/
             http://marc.theaimsgroup.com/?l=cgiapp&r=1&w=2
To unsubscribe, e-mail: suppressed
For additional commands, e-mail: suppressed


Mail converted by mhonarc 2.6.15
This archive provided courtesy of JSW4.NET, Internet Hosting Services for Small Business.