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

redisdown

v0.1.12

Published

redis adapter for levelup

Downloads

3,394

Readme

RedisDOWN Build Status

Redis backend for LevelUP

Requirements:

  • redis-2.8 or more recent.
  • node-0.10, node-0.11, iojs-1.0.1

Uses a sorted-set to order the keys and a hash to store the values.

Fetches the ordered key value pairs during iterations with a single redis lua call.

Abstract-LevelDOWN testsuite is green except for the 'implicit iterator snapshot'.

Example

Copied and pasted from the levelup documentation. Added the db option when creating the db to use redisdown.

var levelup = require('levelup')
var redisdown = require('redisdown')

// 1) Create our database, supply location and options.
//    This will create or open the underlying LevelDB store.
var db = levelup('mydb', { db: redisdown, host: 'localhost', port: 6379 })

// if you already have a redis client
//var db = levelup('mydb', { db: redisdown, redis: redisClient })

// if you use an URL environment variable
//var db = levelup('mydb', { db: redisdown, url: process.env.REDIS_URL })
// if you use Redis Cloud on Heroku
//var db = levelup('mydb', { db: redisdown, url: process.env.REDISCLOUD_URL })

// 2) put a key & value
db.put('name', 'LevelUP', function (err) {
  if (err) return console.log('Ooops!', err) // some kind of I/O error

  // 3) fetch by key
  db.get('name', function (err, value) {
    if (err) return console.log('Ooops!', err) // likely the key was not found

    // ta da!
    console.log('name=' + value)
  })
})

API


redisdown(location)

redisdown() returns a new RedisDOWN instance. location is a String pointing at the root namespace of the data in redis.

  • location+':h' is the hash where the values are stored.
  • location+':z' is the set where the keys are sorted.

redisdown#open([options, ]callback)

open() is an instance method on an existing database object.

options is a hash that is passed to the redis library to create a redis client:

  • highWaterMark number of values to fetch in one redis call for iteration. Defaults to 256.
  • port redis port. Defaults to '127.0.0.1'
  • host redis host. Defaults to 6379
  • redis already configured redis client. redisDown will not open or close it. host and port and all other redis options are ignored.
  • Other options: https://github.com/mranney/node_redis#rediscreateclientport-host-options

redisdown.destroy(location, [options, ]callback)

destroy() is used to completely delete all data in redis related to the location.

Pouchdb integrations tests: all 3605 of them


npm run-script test-pouchdb-redis

The script will install the extra required dependencies. It works for me.

LICENSE

redisdown is freely distributable under the term of the MIT License. Copyright: Sutoiku Inc 2014.

If you need something different, let me know.

HELP Wanted

  • Collation: do we need to worry about this?