npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2024 – Pkg Stats / Ryan Hefner

pome-sync

v0.0.4

Published

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

Downloads

6

Readme

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

As we known, updating data is very frequently in game application. Especial in MMORPG kind game. User game data,such as location,flood,equipment,etc. almost always change as time going. For the purpose of avoid such update action cost, we decide to keep a copy data in memory. And keep synchronized with a timer and log;

Data sync can support both timer call and instance invoke for the different situation. Most of time the developer don't pay attention to it;

Data sync also can support memory operation like NOSQL database such as redis,mongodb etc. most of time developer can seem as a memory database without transaction.

Data sync features include timer sync,set,get,mset,mget,hset,hget,incr,decr,flush,merger,showdown,info,etc. and the developer can extend it very easily.

##Installation

npm install pome-sync

##Usage


var opt = opt || {};

var updateUser = function(dbclient,val) {
    console.log('mock save %j',val);
}

var dbclient = {};//db connection etc;
var id = 10001;
var optKey = 'updateUser';
var mapping = {}; //key function mapping 
mapping[optKey]=updateUser;
opt.mapping = mapping;
opt.client = dbclient;
opt.interval = 2000;

var Sync = require('pome-sync');
var sync = new Sync(opt) ;
sync.exec(optKey,id,{name:'hello'});

##API ###sync.exec(key,id,val,cb) Add a object to sync for timer exec call back. ####Arguments

  • key - the key function mapping for wanted to call back,it must be unique.
  • id - object primary key for merger operation.
  • val - the object wanted to synchronized.
  • cb - the function call back when timer exec.

###sync.flush(key,id,val,cb) immediately synchronized the memory data with out waiting timer and will remove waiting queue data; ####Arguments

  • key - the key function mapping for wanted to call back,it must be unique.
  • id - object primary key for merger operation.
  • val - the object wanted to synchronized.
  • cb - the function call back when timer exec.

###sync.isDone get the db sync status when the queue is empty,it should return true;otherwise return false;

##Notice system default sync time is 1000 * 60, 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.

##ADD for more usage detail , reading source and benchmark and test case from source is recommended;