nikolaposa / rate-limit

🚔 General purpose rate limiter implementation.
MIT License
271 stars 47 forks source link

Support for custom rate limits #20

Closed virtualize closed 4 years ago

virtualize commented 4 years ago

Motive: https://github.com/nikolaposa/rate-limit/issues/19

nikolaposa commented 4 years ago

@virtualize What do you think about alternative approach, of adding new named constructor that would allow custom values, and keeping built-in constructor as is? For example:

public static function custom(int $operations, int $interval)
{
    return new static($operations, $interval);
}
$rate = Rate::custom(500, 3*3600)
virtualize commented 4 years ago

Like the idea very much and updated the PR. Thanks.