npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

haraka-plugin-ioredis

v1.0.7-ioredis.3

Published

Redis plugin for Haraka & other plugins to inherit from

Downloads

22

Readme

haraka-plugin-ioredis

Forked from haraka-plugin-redis. This fork replaces node_redis with ioredis. Configuration file uses YAML instead of INI.

Connects to a redis instance. By default it stores a redis connection handle at server.notes.redis. See below to get a custom DB handle attached to another database.

Config

The redis.yaml file has the following sections (defaults shown):

server:

# host=127.0.0.1
# port=6379
# db=0

pubsub:

# host=127.0.0.1
# port=6379

Publish & Subscribe are DB agnostic and thus have no db setting. If host and port and not defined, they default to the same as [server] settings.

opts:

# see https://www.npmjs.com/package/ioredis#connect-to-redis

Usage (shared redis)

Use redis in your plugin like so:

if (server.notes.redis) {
    server.notes.redis.hgetall(...);
        // or any other redis command
}

Publish/Subscribe Usage

In your plugin:

exports.results_init = function (next, connection) {
    var plugin = this;
    plugin.redis_subscribe(connection, function () {
        connection.notes.redis.on('pmessage', function (pattern, channel, message) {
            plugin.do_something_with_message(message, ...);
        });
        next();
    });
}
// be nice to redis and disconnect
exports.hook_disconnect = function (next, connection) {
    this.redis_unsubscribe(connection);
}

Custom Usage

This variation lets your plugin establish its own Redis connection, optionally with a redis db ID.

exports.register = function () {
    var plugin = this;
    plugin.inherits('redis');

    plugin.cfg = plugin.config.get('my-plugin.ini');

    // populate plugin.cfg.redis with defaults from redis.ini
    plugin.merge_redis_ini();

    // cluster aware redis connection(s)
    plugin.register_hook('init_master', 'init_redis_plugin');
    plugin.register_hook('init_child',  'init_redis_plugin');
}

When a db ID is specified in the [redis] section of a redis inheriting plugin, log messages like these will be emitted when Haraka starts:

[INFO] [-] [redis] connected to redis://172.16.15.16:6379 v3.2.6
[INFO] [-] [limit] connected to redis://172.16.15.16:6379/1 v3.2.6
[INFO] [-] [karma] connected to redis://172.16.15.16:6379/2 v3.2.6
[INFO] [-] [known-senders] connected to redis://172.16.15.16:6379/3 v3.2.6

Notice the database ID numbers appended to each plugins redis connection message.

[![Coverage Status][cov-img]][cov-url] nyet