0.0.7 • Published 10 years ago

rob v0.0.7

Weekly downloads
2
License
MIT
Repository
github
Last release
10 years ago

node-rob

Build Status Coverage Status

Autosaving objects in redis

Installation

npm install --save rob

Usage

var AutosaveObject = require('rob').AutosaveObject;
var Person = AutosaveObject.extend({
  fullName: function () {
    return this.firstName + this.lastName;
  }
  keyGenerator: function () {
    // Optional custom key generator
    return this.firstName;
  }
})
var albus = new Person(null, {
  firstName: 'Albus Percival Wulfric Brian',
  lastName: 'Dumbledore'
});

albus.set('age', 116); // This will write the object to redis
albus.get('lastName'); // returns 'Dumbledore'
albus.fullName(); // returns 'Albus Percival Wulfric Brian Dumbledore'

Person.fetch().then(function (result) {
  // result will be a list containing an instance equal to rob above
});
Person.fetch(albus.key).then(function (result) {
  // result will be an instance equal to rob above
});

Want more info?

Read the tests or the source. More documentation is coming later..


MIT © Rolf Erik Lekang

0.0.7

10 years ago

0.0.6

10 years ago

0.0.5

10 years ago

0.0.4

10 years ago

0.0.3

10 years ago

0.0.2

10 years ago

0.0.1

10 years ago