יובל קוג'מן (Yuval Kogman) > POE-Component-ResourcePool-Resource-TokenBucket-0.01 > POE::Component::ResourcePool::Resource::TokenBucket

Download:
POE-Component-ResourcePool-Resource-TokenBucket-0.01.tar.gz

Dependencies

Annotate this POD

View/Report Bugs
Module Version: 0.01   Source  

NAME ^

POE::Component::ResourcePool::Resource::TokenBucket - Token bucket based resource (for throttling).

SYNOPSIS ^

        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

DESCRIPTIONS ^

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.

ATTRIBUTES ^

alias

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).

token_bucket

The Algorithm::TokenBucket object used to calculate the rate limiting.

This is readonly.

rate
burst

The numerical parameters for Algorithm::TokenBucket used to generate token_bucket.

These are also used for could_allocate, etc.

METHODS ^

See POE::Component::ResourcePool::Resource for the resource API.

SEE ALSO ^

POE, MooseX::POE, Algorithm::TokenBucket, POE::Component::ResourcePool.

VERSION CONTROL ^

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.

AUTHOR ^

Yuval Kogman <nothingmuch@woobling.org>

COPYRIGHT ^

        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.
syntax highlighting: