You're Invited:Meet the Socket Team at BlackHat and DEF CON in Las Vegas, Aug 4-6.RSVP
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

1.0.0
Source
npmnpm
Version published
Weekly downloads
24
118.18%
Maintainers
1
Weekly downloads
 
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