New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
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.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
0
decreased by-100%
Maintainers
1
Weekly downloads
 
Created
Source

cron task for node by redis

Inspired by the bull

usage

client

  1. Initialize the redis config
  2. register function for callback
  3. 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,
  DB: 1,
  opts: {
    auth_pass: 'root',
    password: 'root'
  }
}
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}

    • rule {options} cron rule . {Date} or {* */1 * * * *}

Supported format

*    *    *    *    *    *
┬    ┬    ┬    ┬    ┬    ┬
│    │    │    │    │    |
│    │    │    │    │    └ day of week (0 - 7) (0 or 7 is Sun)
│    │    │    │    └───── month (1 - 12)
│    │    │    └────────── day of month (1 - 31)
│    │    └─────────────── hour (0 - 23)
│    └──────────────────── minute (0 - 59)
└───────────────────────── second (0 - 59, optional)

or

new Date();
moment().add(3, 's').toDate()

More

bull

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc