The new version of pomelo enhances the ability to support user expansion. You only need to use the app. Use (plugin, opts). For details, see the use function in application. js of pomelo. The plug-in must contain the components member. In the use function, pomelo loads the component referred to by componets of plugin and transmits opts to components of this plugin.
Pomelo-sync is only responsible for regular synchronization between DB data and memory data. Therefore, another project pomelo-sync-plugin encapsulates pomelo-sync into a componet. App. Use (require ('melo-sync-plugin', opts) completes the data synchronization plug-in loading.
Pomelo-sync
During pomelo-sync construction, the client (link to the persistence layer) and ing (such as the ing table of SQL statements for various operations) in the parameter are) and so on. At last, enable the timer synctimer to regularly fl memory data to the persistence layer.
External interfaces are not only in dbsync. JS, but also distributed in several files under lib/commands. Exec/flush/Sync is included in commands/server. js.
()Pomelo-sync.exe C
Pomelo-sync.exec function, called by the user program. Put user data into a pomelo-sync.flushQueue or pomelo-sync.mergerMap.
Pomelo-sync.flush (2)
The pomelo-sync.flush function that immediately persists the single-picked data.
Pomelo-sync.sync (2)
The pomelo-sync.sync function, called by synctimer, can also be called by the user program to immediately persist all the memory data. The sync function calls the sync in rewriter. js. Rewriter. Sync fl data in the pomelo-sync.flushQueue and pomelo-sync.mergerMap to the persistent layer through rewrite. Tick. Rewriter. Tick is implemented through the ing corresponding SQL statement in the pomelo-sync.mapping.
Reference from: http://www.cppblog.com/yangsf5/archive/2013/12/04/204582.html
How to Use pomelo-sync for pomelo programs