Product
Introducing SSO
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
redisdown
Advanced tools
Readme
Redis backend for LevelUP
Requirements:
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'.
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)
})
})
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.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 6379redis
already configured redis client. redisDown will not open or close it. host and port and all other redis options are ignored.destroy()
is used to completely delete all data in redis related to the location.
npm run-script test-pouchdb-redis
The script will install the extra required dependencies. It works for me.
redisdown is freely distributable under the term of the MIT License. Copyright: Sutoiku Inc 2014.
If you need something different, let me know.
FAQs
redis adapter for levelup
The npm package redisdown receives a total of 491 weekly downloads. As such, redisdown popularity was classified as not popular.
We found that redisdown demonstrated a not healthy version release cadence and project activity because the last version was released a year ago. It has 1 open source maintainer collaborating on the project.
Did you know?
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.
Product
Streamline your login process and enhance security by enabling Single Sign-On (SSO) on the Socket platform, now available for all customers on the Enterprise plan, supporting 20+ identity providers.
Security News
Tea.xyz, a crypto project aimed at rewarding open source contributions, is once again facing backlash due to an influx of spam packages flooding public package registries.
Security News
As cyber threats become more autonomous, AI-powered defenses are crucial for businesses to stay ahead of attackers who can exploit software vulnerabilities at scale.