🚀 Big News: Socket Acquires Coana to Bring Reachability Analysis to Every Appsec Team.Learn more
Socket
Book a DemoInstallSign in
Socket

mockis

Package Overview
Dependencies
Maintainers
1
Versions
6
Alerts
File Explorer

Advanced tools

Socket logo

Install Socket

Detect and block malicious and high-risk dependencies

Install

mockis

A mock of redis

0.0.6
latest
Source
npm
Version published
Weekly downloads
2
Maintainers
1
Weekly downloads
 
Created
Source

Mockis

A self indulgent coffeescript mock of redis.

Status

Build Status

It works for certain things. It should match the success behavior of the node_redis library. Failure behavior may not match, but we try to do something sane.

It's also very incomplete. I've implemented the basic things I need. I will try to add other things as well, but if it's missing things you need, send a PR.

Supported Commands

Keys
  • expire
  • exists
  • ttl
  • persist
Strings
  • set
  • setex
  • setnx
  • get
  • del
  • incr
  • mget
  • mset
Sets
  • sadd
  • smembers
  • srem
  • sismember
Sorted Sets
  • zadd
  • zrange
  • zrevrange
  • zremrangebyscore
  • zrem
  • zremrangebyrank
Hashes
  • hset
  • hget
  • hgetall
  • hmset
Server
  • flushall
Pub/sub (be sure to check out child nodes)
  • subscribe
  • unsubscribe
  • publish
Transactions
  • multi
  • exec
  • discard
  • watch
  • unwatch

Sharing storage between mockis instances

Multiple instances of Mockis can share the same storage like such:

parent = new Mockis()
child = new Mockis()
parent.addChild(child)

child.set "foo", "bar", ->
  parent.get "foo", (err, result) ->
    result is "bar" # true

One important note about this is that if the child already has data, it will be lost. There is no merge.

Parents can have arbitrary numbers of children. The whole children of children thing can get wacky. Don't do it.

Contribution

Contributions are totes welcome. When possible, please submit a PR for each command. This isn't a requirement, but it can streamline reviewing them.

All methods must call callbacks synchronously. Multi requires it.

Please create at least the most basic of tests for any command you add. Also, test only pull requests are greatly appreciated.

Alternatives

License

Apache 2.0

Author(s)

  • Pat Shields (Adzerk)

Keywords

redis

FAQs

Package last updated on 16 Oct 2013

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