A lightweight library for content flagging backed by Redis, with optional time-window support. Current stable version is 0.1.4. It allows flagging, unflagging, and checking if an element has been flagged, using Redis as the backend. Keys are built by JSON-encoding and SHA1-hashing the element, with configurable key prefix and TTL. Differentiators include simple API, support for any data type (objects, arrays, strings), and the ability to use an existing Redis connection or create a new one. Best suited for preventing duplicate processing, filtering streams, or as a distributed semaphore.
npm install redis-flaggerNo compatibility data collected yet for this library.
Verified import paths — ran on the pinned version, not inferred.
Shows how to import, setup, flag, check, and unflag an element with custom TTL.
Ensure consistent object ordering (e.g., using JSON.stringify with sorted keys) or use string representations.
Set ttl in setup options or pass TTL as second argument to flag().
Use the same Redis client version as tested, or consider wrapping with ioredis.
Use 'import flagger from 'redis-flagger';' instead of 'import { flagger } from 'redis-flagger';'.Start Redis server or specify correct host and port in setup().
Use await flagger.flagged(element) or .then() to get the boolean result.