How to Use pomelo-sync for pomelo programs

Source: Internet
Author: User

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

Contact Us

The content source of this page is from Internet, which doesn't represent Alibaba Cloud's opinion; products and services mentioned on that page don't have any relationship with Alibaba Cloud. If the content of the page makes you feel confusing, please write us an email, we will handle the problem within 5 days after receiving your email.

If you find any instances of plagiarism from the community, please send an email to: info-contact@alibabacloud.com and provide relevant evidence. A staff member will contact you within 5 working days.

A Free Trial That Lets You Build Big!

Start building with 50+ products and up to 12 months usage for Elastic Compute Service

  • Sales Support

    1 on 1 presale consultation

  • After-Sales Support

    24/7 Technical Support 6 Free Tickets per Quarter Faster Response

  • Alibaba Cloud offers highly flexible support services tailored to meet your exact needs.