Fetching contributors…
Cannot retrieve contributors at this time
52 lines (34 sloc) 1.5 KB


This is the Redis driver for Databank.


Copyright 2011-2013, E14N https://e14n.com/

Licensed under the Apache License, Version 2.0 (the "License"); you may not use this file except in compliance with the License. You may obtain a copy of the License at


Unless required by applicable law or agreed to in writing, software distributed under the License is distributed on an "AS IS" BASIS, WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. See the License for the specific language governing permissions and limitations under the License.


To create a Redis databank, use the Databank.get() method:

var Databank = require('databank').Databank;

var db = Databank.get('redis', {});

The driver takes the following parameters:

  • host: the host to connect to; default is
  • port: the port to connect to; default is 6379.
  • schema: the database schema, as described in the Databank README.
  • database: integer representing the Redis database to use; default is 0.

See the main databank package for info on its interface.

Under the covers

Keys in the database have the form "type:id". So a "person" with id "evanp" is at "person:evanp".

Objects and arrays are stored as JSON-encoded strings in the Redis database. Numbers are stored as numbers.

Indices are implemented as sets. Search uses set intersection to quickly find keys to matching objects.