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

jugglingdb-redis-hq

v0.1.4

Published

Redis adapter for jugglingdb

Downloads

68

Readme

JugglingDB-Redis Build Status

Redis adapter for jugglingdb.

Usage

To use it you need [email protected].

  1. Setup dependencies in package.json:
{
  ...
  "dependencies": {
    "jugglingdb": "0.2.x",
    "jugglingdb-redis": "latest"
  },
  ...
}
  1. Use:
    var Schema = require('jugglingbd').Schema;
    var schema = new Schema('redis');

Running tests

Make sure you have redis server running on default port, then run

npm test

Be careful, it could delete your data in database number 0

Additional Features

Backyard

Enabling this feature allows to keep only "hot" data in redis and unload rarely used data to backyard.

Backyard is an additional storage that used by redis adapter to mirror all data. Data in redis has some expiration period when mirrored in backyard database. When expired data requested from redis (actual record is not present), then record loaded from backyard and restored in redis. Each time record requested expiration timeout renewed.

Configuration

Include backyard section using the same format as normal schema settings definition in config/database.js:

exports.development = {
    main: {
        driver: 'redis-hq',
        database: 1,
        log: true,
        backyard: {
            driver: 'mysql',
            username: 'root',
            database: 'myapp'
            log: true,
        }
    }
};

Use expire setting for model in db/schema.js:

db.define('Comment', function(m) {
    m.property('text', String);
    m.set('expire', 30); // expire record in 30 seconds
});

This setting may be also set to -1 to disable expiration.

Usage

Use your models as usual. All data where expire is not set to -1 will be mirrored automatically and restored in redis db when requested after expiration.

Please note that you will get an additional error messages from backyard database. Expiration only being set when both redis and backyard db responded with success to prevent data loss.

Hint 1. If you are using compoundjs and some sql adapter as backyard for redis, then app.enable('autoupdate'); setting is useful to not care about schema (at least in development env).

Hint 2. Use log: true to debug sql queries.

Hint 3. Make sure your schema is sql-friendly. The most often bottleneck is indexes length, specify length attribute for each indexed String property.