Ecosyste.ms: Awesome

An open API service indexing awesome lists of open source software.

Awesome Lists | Featured Topics | Projects

https://github.com/pastuhov/yii2-redis-ticker

Returns true every N seconds
https://github.com/pastuhov/yii2-redis-ticker

Last synced: 6 days ago
JSON representation

Returns true every N seconds

Awesome Lists containing this project

README

        

# Yii2 redis ticker

[![Build Status](https://travis-ci.org/pastuhov/yii2-redis-ticker.svg)](https://travis-ci.org/pastuhov/yii2-redis-ticker)
[![Scrutinizer Code Quality](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-ticker/badges/quality-score.png?b=master)](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-ticker/?branch=master)
[![Code Coverage](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-ticker/badges/coverage.png?b=master)](https://scrutinizer-ci.com/g/pastuhov/yii2-redis-ticker/?branch=master)
[![Total Downloads](https://poser.pugx.org/pastuhov/yii2-redis-ticker/downloads)](https://packagist.org/packages/pastuhov/yii2-redis-ticker)

## Install

Via Composer

``` bash
$ composer require pastuhov/yii2-redis-ticker
```

## Features

* Just tick

## Usage

```php
$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

```bash
$ composer test
```
or
```bash
$ phpunit
```

## Debugging

For debugging purposes use:

```bash
$ redis-cli monitor
```
or

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

## Security

If you discover any security related issues, please email [email protected] instead of using the issue tracker.

## Credits

- [Kirill Pastukhov](https://github.com/pastuhov)
- [All Contributors](../../contributors)

## License

GNU General Public License, version 2. Please see [License File](LICENSE) for more information.