Socket
Socket
Sign inDemoInstall

mock-redis-client

Package Overview
Dependencies
2
Maintainers
1
Versions
16
Alerts
File Explorer

Advanced tools

Install Socket

Detect and block malicious and high-risk dependencies

Install

    mock-redis-client

A redis mock for node development


Version published
Weekly downloads
1.9K
increased by13.68%
Maintainers
1
Install size
1.49 MB
Created
Weekly downloads
 

Readme

Source

Mock Redis Client


A redis mock for node

NPM version Build Status Dependency Status

Introduction

The mock redis client borrows methods from node-redis-mock which was originally cloned from redis-mock. There are a few more implementations, like mset, mget, etc.

This project isn't a clone of mock-redis-client or mock-redis, rather it uses encapulation to inherit methods implemented by the base object. It's a cleaner way of extending the original works from both projects.

Installation

	npm install mock-redis-client --save-dev

Use

	var MockRedisClient = require('mock-redis-client');

    var client = new MockRedisClient();

Or if you need to mock redis itself, then do this:

    var redis = require('mock-redis-client').createMockRedis();

    var client = redis.createClient();

API

Currently implemented are the following:

General

  • createClient
  • end

Events

  • ready
  • connect
  • end
  • subscribe
  • unsubscribe
  • message

Publish/subscribe

  • publish
  • subscribe
  • unsubscribe

Keys

  • del
  • keys
  • exists
  • expire

Strings

  • get
  • set
  • incr
  • mset
  • mget

Hashing

  • hset
  • hsetnx
  • hget
  • hexists
  • hdel
  • hlen
  • hgetall
  • hmset
  • hkeys
  • hincrby

Lists

  • llen
  • lpush
  • rpush
  • lpushx
  • rpushx
  • lpop
  • rpop
  • blpop
  • brpop
  • lindex
  • lset
  • rpoplpush

Server

  • flushdb
  • flushall
  • save
  • lastsave
  • time
  • dbsize (always returns zero)
  • ping

Transactions

  • multi
  • exec
  • every previous supported commands can be chained

Tests

    make test

    or

    make watch

    or

    grunt mochaTest jshint validate-package

Copyright © 2014-2016, rain city software | Version 0.91.13

Keywords

FAQs

Last updated on 18 Feb 2016

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.

Install

Related posts

SocketSocket SOC 2 Logo

Product

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

Stay in touch

Get open source security insights delivered straight into your inbox.


  • Terms
  • Privacy
  • Security

Made with ⚡️ by Socket Inc