0.0.1 • Published 11 years ago

model-redis-sync v0.0.1

Weekly downloads
1
License
-
Repository
-
Last release
11 years ago

model-redis-sync

redis sync adaptor for use with node-model.

Installation

npm install model-redis-sync

Example

var model = require('node-model')
var redisOptions = {
  host: '...',
  port: '...'
}
var redisSync = require('model-redis-sync')(redisOptions)

var Post = model('Post')
  .attr('id')
  .attr('title')
  .attr('body')

Post.base = 'post'
Post.sync = redisSync

var post = new Post({title: "My Awesome Post", body: "Is awesome"})
post.save(function(err) {
  ...
})

Post.base is used to determine the redis key. In this case it will be post:uuid

Tests

npm test