New Case Study:See how Anthropic automated 95% of dependency reviews with Socket.Learn More
Socket
Sign inDemoInstall
Socket

redis-json

Package Overview
Dependencies
Maintainers
1
Versions
22
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

redis-json

A wrapper library to store JSON Objects in redis-hashsets and retrieve it back as JSON objects

  • 1.0.1
  • Source
  • npm
  • Socket score

Version published
Weekly downloads
5.7K
decreased by-20.62%
Maintainers
1
Weekly downloads
 
Created
Source

redis-json

Description

This library will store the JSON Object in Redis Hash-Sets and similarly you can retrieve the JSON data from Redis back in JSON object format.

Installation

npm install redis-json --save-dev

Usage

var Redis = require('ioredis');
var JSONStore = require('./');

var redis = new Redis();

var jsonStore = new JSONStore(redis);

jsonStore.set('user', {
    a: 1,
    b: 2,
    c : {
        d: 3,
        e: 4
    }
}, function(err, result){
    console.log(err, result);
})

API

set(key, jsobObject, callback)

key: The redis key that the JSON object has to be stored against.
jsonObject: JSON obejct that needs to be stored.
callback(err, result): Will be called only the data is stored into redis.

if the key already exists, and is of type hashset, then the field in JSON object will get updated along with the existing data.

get(key, callback)

key: The redis key in which the JSON object was stored. callback(err, result): Will be called after fetching data from redis.

if the key is not of type hashset, then redis will through error.

resave(key, jsonObj, callback)

key: The redis key that whose value needs to be replaced with the new one. jsonObject: JSON obejct that needs to be stored.
callback(err, result): Will be called once the data is replaced with the new JSON object.

Even if key is not of type hashset, resave will delete it and update the JSON object in the provided key.

Keywords

FAQs

Package last updated on 12 Nov 2016

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

SocketSocket SOC 2 Logo

Product

  • Package Alerts
  • Integrations
  • Docs
  • Pricing
  • FAQ
  • Roadmap
  • Changelog

Packages

npm

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc