POE::Component::ResourcePool::Resource::TokenBucket - Token bucket based resource (for throttling).
use POE::Component::ResourcePool::Resource::TokenBucket; my $tb = POE::Component::ResourcePool::Resource::TokenBucket->new( # see Algorithm::TokenBucket rate => $per_second, burst => $max_item_size, ); my $pool = POE::Component::ResourcePool->new( resources => { rate_limit => $tb, }, ); # requests can ask the rate_limit resource to throttle them now
This class implements an Algorithm::TokenBucket based resource for POE::Component::ResourcePool.
Requests are numeric value based, and will be served as the token bucket fills.
This is useful for rate limiting of jobs in a time based way.
The POE alias for the internal session.
Comes from MooseX::POE::Aliased.
The alias can be set explicitly but is not yet useful for anything (there is no POE side API for this object, all session states are internal).
The Algorithm::TokenBucket object used to calculate the rate limiting.
This is readonly.
The numerical parameters for Algorithm::TokenBucket used to generate token_bucket.
token_bucket
These are also used for could_allocate, etc.
could_allocate
See POE::Component::ResourcePool::Resource for the resource API.
POE, MooseX::POE, Algorithm::TokenBucket, POE::Component::ResourcePool.
This module is maintained using Darcs. You can get the latest version from http://nothingmuch.woobling.org/code, and use darcs send to commit changes.
darcs send
Yuval Kogman <nothingmuch@woobling.org>
Copyright (c) 2008 Yuval Kogman. All rights reserved This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.
To install POE::Component::ResourcePool::Resource::TokenBucket, copy and paste the appropriate command in to your terminal.
cpanm
cpanm POE::Component::ResourcePool::Resource::TokenBucket
CPAN shell
perl -MCPAN -e shell install POE::Component::ResourcePool::Resource::TokenBucket
For more information on module installation, please visit the detailed CPAN module installation guide.