Skip to content

data sync module is simple sync memory data into store engine like mysql,redis,file.

Notifications You must be signed in to change notification settings

piaohai/pomelo-sync

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

###README

data sync module is simple sync memory data into store engine like mysql,redis,file.

### import 
try {
  var DBsync = require('dbsync');
} catch (err) {
  var DBsync = require('../');
}

#### create options

/**
 * Options.
 */

var options = {};

/**
 * Usage information.snyc for file 
 */
//var FileRewriter = require('../lib/rewriter/filerewriter');
//options.rewrite = new FileRewriter();
//options.interval = 1000 * 60 * 3; //default sync timer


### Start server
var sync = new DBsync(this,opt) ;

### register object
var user1 = new User('hello');
var user2 = new User('world');

var key = 'hello';

sync.set(key,user1,function(err,resp){
	console.log('app.js register user1 result error=' + JSON.stringify(err) + ' resp ' + JSON.stringify(resp));
});

sync.set('world',user2,function(err,resp){
	console.log('app.js register user2  result error=' + err + ' resp ' + JSON.stringify(resp));
});

sync.get(key,function(err,resp){
	console.log(' app.js get  result error=' + err + ' resp ' + JSON.stringify(resp));
});


### notice 

system default sync time is 1000 * 60 * 3,

if you use mysql or redis sync,you should set options.client,the file sync is default but it doesn't load in current.

mysql OR mapping in this modules do not support,user should realize it self.

/**
 * Usage information.snyc for mysql 
 */
//var dbclient = require('./mysql/mysql');
//var Mysqlrewriter = require('./mysqlrewriter');
//var opt = {};
//opt.client = dbclient;
//opt.rewriter = new Mysqlrewriter();
//opt.interval = 1000 * 10;

About

data sync module is simple sync memory data into store engine like mysql,redis,file.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published