pastuhov/yii2-redis-ticker

Yii2 Redis ticker.

v0.1.0 2016-01-22 10:11 UTC

This package is not auto-updated.

Last update: 2024-11-13 19:45:48 UTC


README

Build Status Scrutinizer Code Quality Code Coverage Total Downloads

Install

Via Composer

$ composer require pastuhov/yii2-redis-ticker

Features

  • Just tick

Usage

$ticker = \Yii::createObject([
	'class' => \pastuhov\yii2redisticker\RedisTicker::className(),
	'redis' => $redisConnection
]);

$tickerName = 'tak';

if ($ticker->tick($tickerName, 15)) {
	$value++;
}
// value = 1

if ($ticker->tick($tickerName, 15)) {
	$value++;
}
// value = 1

sleep(20);

if ($ticker->tick($tickerName, 15)) {
	$value++;
}
// value = 3

Testing

$ composer test

or

$ phpunit

Debugging

For debugging purposes use:

$ redis-cli monitor

or

$ tail -f tests/runtime/logs/app.log -n 1000

Security

If you discover any security related issues, please email kirill@pastukhov.su instead of using the issue tracker.

Credits

License

GNU General Public License, version 2. Please see License File for more information.