New Research: Supply Chain Attack on Axios Pulls Malicious Dependency from npm.Details →
Socket
Book a DemoSign in
Socket

redis-list-objects

Package Overview
Dependencies
Maintainers
1
Versions
3
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-list-objects

store and query json objects in redis lists

latest
npmnpm
Version
0.10.0
Version published
Maintainers
1
Created
Source

store and query json objects in redis lists

installation

install package itself with:

npm install redis-object-store

module also depends on redis:

npm install redis

you maybe want to use hiredis too:

npm install hiredis

usage

// examples/example-1.js

var RedisObjectStore = require ('redis-object-store'),
	redis = require ('redis');

var redisClient = redis.createClient ();

var store = new RedisObjectStore ('test', redisClient);

var doc = {
	foo: 'foo',
	bar: 1
};

store.insert (doc, function (err) {
   store.query ({
        foo: 'foo'
   }, function (err, result) {
        console.log (result); // -> [{foo:"foo",bar:1}]
   });
});

interface

.constructor (name:String, redis:RedisClient, [options])

where options follows the schema:

options = {
    blockSize: 100,
    serialize: function (object) {
        return JSON.stringify (object);
    },
    parse: function (string) {
        return JSON.parse (string);
    }
}

.insert (documents, [function(err)])

documents may be single object as well as array of objects

.query ([mongodbQuery], function(err, result)]

mongodbQuery is parsed by sift

internals

module store inserted objects in redis list as follow:

this.redis.rpush (this.name, this.serialize(document))

module fetches documents from redis as follow:

this.redis.lrange (this.name, 0, length, function (err, result) {
    var parsedResults = [],
        sifted = sift (mongodbQuery);
    results.forEach (function(data){
        parsedResults.push (this.parse(data));
    });
    callback (err, sifted(parsedResults));
});

FAQs

Package last updated on 29 Jan 2014

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