1.0.3 • Published 4 years ago

ttl-counter v1.0.3

Weekly downloads
6
License
MIT
Repository
github
Last release
4 years ago

TTL counter

TTL counter allow you to define some counters with TTL expire. Also you can call callback, when some threshold of counter reached.

Example

import { TTLCounter } from 'ttl-counter';

const ttlCounter = new TTLCounter({
  ttl: 60 * 1000 // TTL for specific counter,
  countForCb: 50 // After 50 count per minute, callback called,
  cb (counterId) {
    // For example, many errors occured per minute, restart pod
    process.exit(1);
  }
});

// On error call
ttlCounter.count('error');
1.0.3

4 years ago

1.0.2

5 years ago

1.0.1

5 years ago

1.0.0

5 years ago