0.2.2 • Published 7 years ago

redis-suspend v0.2.2

Weekly downloads
12
License
GPL-3.0
Repository
github
Last release
7 years ago

Redis wrapper adding suspend module support.

Features

  • Exposes all REDIS commands and wraps them with generator/yield async control flows.
  • Provides two helper methods for searching and looping through values: getSearch and delSearch.
  • Allows direct access to the underlying redis client.

install

Requirements

  • ECMAScript 2015 (ES6)
  • Node.JS 6.2.2 or later (tested on 6.2.2)

Basic Example

Helper Methods exclusive to this module:

getDefault(key,defaultValue)

Just like the standard .get(key) method, but instead will allow you to provide a default value if the key is not found or is null.

getJson(key)

Will attempt to automatically parse the JSON and return the object.

setJson(key, object)

Will attempt to convert passed in object to JSON and save to key.

getSearch(key, callback(key,value,cbnext) )

This method allows you to loop over key/values that match your search criteria. Internally it uses the SCAN redis command.

delSearch(key)

This method is similar to the getSearch method, but instead of allowing you to loop through the results, it deletes them, and then returns the delete count.

multi() Functionality

Multi allows commands to be queued together, and ensures that all commands succeed or all fail.

.mutli() chaining functionality is not supported by this module. You may access its functionality by not chaining it. Such as:

And you may access its functionality by accessing the node_redis client directly by using the rs.client property.

Based on node_redis

This module wraps the node_redis module. Please review this module for more information about what methods and commands are available to you.