🚀 DAY 5 OF LAUNCH WEEK:Introducing Webhook Events for Alert Changes.Learn more →
Socket
Book a DemoInstallSign in
Socket

cron-redis

Package Overview
Dependencies
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

cron-redis

cron task for node by redis

Source
npmnpm
Version
1.0.0
Version published
Maintainers
1
Created
Source

cron task for node by redis

Inspired by the bull

usage

client

  • Initialize the redis config
  • register function for callback
  • publish task
var cronRedis = require('cron-redis')(appName, redisConfig);

function hello (x, y){
    return x + y;
}
cronRedis.register(hello); 

var task = {
  method: hello.name,
  params: [2, 3],
  rule: new Date()
};

// publish a task
cronService.publish(task);


API

require('cron-redis')(appName, redisConfig)

init config

  • appName {String} what your app's name?

  • redisConfig {Object}

    {
      host: '127.0.0.1',
      port: 6379,
      password: '',
      db: 0
      }
    

register

register a task

  • method {Function} // method for cron task callback

publish

add a task to queue

  • task {Object}
    • method {String} the name of method will be callback.
    • params {Array}

FAQs

Package last updated on 14 Mar 2016

Did you know?

Socket

Socket for GitHub automatically highlights issues in each pull request and monitors the health of all your open source dependencies. Discover the contents of your packages and block harmful activity before you install or update your dependencies.

Install

Related posts