credy/yii2-leakybucket

1.0.1 2024-07-05 15:48 UTC

This package is auto-updated.

Last update: 2024-12-05 14:03:29 UTC


README

===========

Configuration:

LeakyBucket Component:

Put following snippet into your config

return [
    'components' => [
        'leakyBucket' => [
            'class' => credy\leakyBucket\handlers\DummyHandler::class,
        ]
    ]
];

Usage

In your class:

class YourClassName extends BaseObject
{
    public function yourMethod()
    {
        Yii::$app->leakyBucket->try(
            'unique key',
            function () {
                //insert your code here
            }
        );
    }
}