{"id":46154,"library":"redis-scheduler","title":"Redis Scheduler","description":"A Node.js library (v1.0.0) that uses Redis keyspace notifications to trigger timed events. Inspired by Codezuki's blog post, it allows scheduling, rescheduling, and cancelling events with multiple handlers per key. Requires Redis 2.8+ with keyspace notifications enabled (notify-keyspace-events Ex). Unlike typical job queues, it leverages Redis' native expiry mechanism. Stable but not actively maintained; last release was several years ago. Suitable for simple timer-based tasks but not for high-throughput or persistent job queues.","status":"maintenance","version":"1.0.0","language":"javascript","source_language":"en","source_url":"git://github.com/petreboy14/redis-scheduler","tags":["javascript","redis","event","queue","schedule"],"install":[{"cmd":"npm install redis-scheduler","lang":"bash","label":"npm"},{"cmd":"yarn add redis-scheduler","lang":"bash","label":"yarn"},{"cmd":"pnpm add redis-scheduler","lang":"bash","label":"pnpm"}],"dependencies":[{"reason":"Redis client used to interact with the Redis server","package":"redis","optional":false}],"imports":[{"note":"This package uses CommonJS. ESM import is not supported.","wrong":"import Scheduler from 'redis-scheduler';","symbol":"Scheduler","correct":"const Scheduler = require('redis-scheduler');"},{"note":"Options object is required. If null, defaults to { host: 'localhost', port: 6379, db: 0 }.","wrong":"","symbol":"Scheduler","correct":"const scheduler = new Scheduler({ host: 'localhost', port: 6379 });"},{"note":"expire can be a number (milliseconds from now) or a Date object. Handler is called with (err, key).","wrong":"scheduler.schedule({ key: 'test', expire: new Date(), handler: fn }, cb);","symbol":"schedule","correct":"scheduler.schedule({ key: 'test', expire: 1000, handler: fn }, cb);"}],"quickstart":{"code":"const Scheduler = require('redis-scheduler');\n\n// Create a scheduler instance\nconst scheduler = new Scheduler({ host: 'localhost', port: 6379 });\n\n// Define a handler function\nfunction myHandler(err, key) {\n  console.log(`Event triggered for key: ${key}`);\n}\n\n// Schedule an event in 2 seconds\nscheduler.schedule({ key: 'my-event', expire: 2000, handler: myHandler }, function(err) {\n  if (err) {\n    console.error('Error scheduling:', err);\n  } else {\n    console.log('Event scheduled');\n  }\n});\n\n// Close the scheduler after some time\nsetTimeout(() => {\n  scheduler.end();\n  console.log('Scheduler closed');\n}, 5000);","lang":"javascript","description":"Initializes a redis-scheduler instance, schedules an event with a 2-second delay, and closes the scheduler after 5 seconds."},"warnings":[{"fix":"Set notify-keyspace-events Ex in redis.conf or via CONFIG SET notify-keyspace-events Ex.","message":"Keyspace notifications must be enabled in Redis configuration: 'notify-keyspace-events Ex'.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Upgrade Redis to version 2.8.0 or later.","message":"Redis 2.8.0 or higher is required. Older versions do not support keyspace notifications.","severity":"gotcha","affected_versions":">=0.0.0"},{"fix":"Pin the 'redis' dependency version to avoid incompatibilities.","message":"The package uses the 'redis' npm package which may have breaking changes in newer versions.","severity":"deprecated","affected_versions":">=1.0.0"},{"fix":"Use distinct keys for different events to prevent accidental cross-cleanup.","message":"Handler removal on cancel may not clean up all references if multiple patterns match the same key.","severity":"gotcha","affected_versions":">=0.0.0"}],"env_vars":null,"search_vec":"'2.8':36 'activ':59 'ago':66 'allow':23 'base':72 'blog':20 'cancel':27 'codezuki':18 'enabl':40 'event':15,28,44,86 'ex':45 'expiri':54 'handler':31 'high':78 'high-throughput':77 'inspir':16 'javascript':84 'job':48,82 'key':33 'keyspac':10,38,43 'last':61 'leverag':51 'librari':5 'maintain':60 'mechan':55 'multipl':30 'nativ':53 'node.js':4 'notif':11,39 'notifi':42 'notify-keyspace-ev':41 'per':32 'persist':81 'post':21 'queue':49,83,87 'redi':1,9,35,52,85 'releas':62 'requir':34 'reschedul':25 'schedul':2,24,88 'sever':64 'simpl':69 'stabl':56 'suitabl':67 'task':73 'throughput':79 'time':14 'timer':71 'timer-bas':70 'trigger':13 'typic':47 'unlik':46 'use':8 'v1.0.0':6 'year':65","created_at":"2026-06-07T12:58:32.673359+00:00","updated_at":"2026-06-07T12:58:32.673359+00:00","problems":[{"fix":"Run 'redis-cli config set notify-keyspace-events Ex' or set it in redis.conf.","cause":"Redis keyspace notifications are not turned on.","error":"Error: ERR DISABLED keyspace notifications are not enabled"},{"fix":"Use require('redis-scheduler') as CommonJS; ensure the package is installed correctly.","cause":"Using incorrect import (e.g., ESM import) or packaging issue.","error":"TypeError: scheduler.schedule is not a function"},{"fix":"Pass a valid number of milliseconds or a Date object to expire.","cause":"expire parameter is not a number or Date object.","error":"Error: ReplyError: ERR value is not a valid expire time"}],"ecosystem":"npm","meta_description":null,"install_score":null,"quickstart_score":null,"quickstart_tag":null,"pypi_latest":null,"cli_name":null,"cli_version":null,"type":"library","homepage":"https://github.com/petreboy14/redis-scheduler","github":"git://github.com/petreboy14/redis-scheduler","docs":null,"changelog":null,"pypi":null,"npm":"redis-scheduler","openapi_spec":null,"status_page":null,"smithery":null,"categories":["messaging"],"base_url":null,"auth_type":null,"provenance":{"verified_status":null,"verified_at":null,"last_verified":"2026-06-07","next_check":"2026-09-05","install_tag":null}}