Skip to content
This repository

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Redis storage engine for resourceful

branch: master

Fetching latest commit…

Octocat-spinner-32-eaf2f5

Cannot retrieve the latest commit at this time

Octocat-spinner-32 examples
Octocat-spinner-32 lib
Octocat-spinner-32 test
Octocat-spinner-32 .gitignore
Octocat-spinner-32 .travis.yml update readme April 10, 2012
Octocat-spinner-32 README.md
Octocat-spinner-32 package.json version bump July 23, 2012
README.md

resourceful-redis

A Redis engine for resourceful, a model framework from the flatiron project.

Build Status

Acknowledgement

resourceful-redis is based on all the other resourceful engines including the standard couchdb and memory engines. Also inspired by the following projects:

Status

resourceful-redis is just getting started. I wouldn't use it in production yet but try it out and if you find bugs create an issue so we can get it to a production ready state soon.

Example

  var redisConnection = redis.createClient(); // an external redis connection

  var resourceful = require('../lib/resourceful-redis');

  var Creature = resourceful.define('creature', function () {

    // Specify redis engine and connection
    this.use("redis", {
      // You can pass in a connection object which is recommened or
      // a uri string to create a connection per model
      connection: redisConnection, // Pass in a redis connection
      // uri: "redis://DB:Pass@127.0.0.1:6379", // Set connection string here, auth is optional
      namespace: "<KEY TO USE AS NAMESPACE>" // Each model will have a different namespace to use as a key
    });

    // Specify some properties
    this.string('diet');
    this.bool('vertebrate');
    this.array('belly');

    this.timestamps();
  });

  Creature.prototype.feed = function (food) {
    this.belly.push(food);
  };

Resourceful API

Resourceful-redis uses the engines-test.js test suite from the resourceful project in order to try and ensure API compatibility. It's edited to use mocha instead of Vows but should be similar.

Currently resourceful-redis should support all of the CRUD methods that resourceful defines as well as simple find's and filters. In the future I would like to implement relationship modeling and hooks for redis pub/sub functionality.

Installation

Installing resourceful-redis

  $ [sudo] npm install resourceful-redis

Tests

All tests are written with mocha and should be run with npm:

  $ npm test

Author: Cody Stoltman

License: Apache 2.0

Something went wrong with that request. Please try again.