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 🙏

© 2025 – Pkg Stats / Ryan Hefner

pea-redis

v0.0.16

Published

a middle for operating redis

Readme

npm package

Features

Pea-redis is based on ioredis, it support async/await usage,it's a further encapsulated and functionally extended functional class. Based on the basic functions of ioredis, it adds operations on objects, and hash, making it easier for Nodejs developers to operate redis.

  1. set/get hset/hget Object into/from redis, easy for Nodejs developer to use
  2. it support async/await usage

Quick Start

Install

$ npm i pea-redis

Basic Usage

set/get Object

await peaRedis.set('a',{'a':1});
const a = await peaRedis.get('a'); // a = {'a':1}

set/get Value

await peaReids.setValue('b', 'this is string');
const c = await peaReids.getValue('b'); // b = this is string;

hset/hget Object

await peaRedis.hset('c','c',{c:1});
const b = await peaRedis.hget('c', 'c'); // c = {c:1}

hset/hget Value

await peaRedis.hsetValue('d','d','d');
const b = await peaRedis.hgetValue('d', 'd'); // d

If you want to delete some cache in the redis, it's more easier than ioredis

For example:


await hdel('obj', 'b');

await del('a');

If you want to use the native method of ioredis, you only need to get the ioredis object and then you can use any ioredis method which you want

For example:


// get ioredis object
const ioRedis = peaRedis.getRedis();

// you can use the native method of ioredis through ioRedis object
ioRedis.set('foo', 'bar');
ioRedis.get('foo', function (err, result) {
  console.log(result);
});

...

see more ioRedis function through: https://github.com/luin/ioredis

Function and params Details:

  1. connect to the redis

//set up your redis config, port, host, db, password, name, if you do not set up config, it will set default config 
connect: function ({config, port, host, db, password, name}){}
//for example
peaRedis.connect({
    port: 6379,
    host: '127.0.0.1',
    db: 'test',
    password: 'test',
    name: 'test'
})
  1. set object to the redis

//this only support object type
set: async function () {}
  1. get value from redis

//this only support String type
get: async function (key) {}
  1. hash set object to redis

//this only support object type
hset: async function (cacheName, key, value) {}
  1. get object from redis

hget: async function (cacheName, key) {}
  1. set string type to redis

//this only support string type
setValue: async function (key, value) {}
  1. get value from redis

getValue: async function (key) {}
  1. hash set string type to redis

//this only support string type
hsetValue: async function (cacheName, key, value) {}
  1. hash get value from redis

hgetValue: async function (cacheName, key) {}
  1. hash delete value from redis

hgetValue: async function (cacheName, key) {}
  1. delete value from redis

del: async function (key) {}
  1. get ioredis object

getRedis: () => {}

Join in!

I'm happy to receive bug reports, fixes, documentation enhancements, and any other improvements.

And since I'm not a native English speaker, if you find any grammar mistakes in the documentation, please also let me know. :)

Contributors

License

MIT