Git Product home page Git Product logo

mock-redis-client's Introduction

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

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.