+

CN109165712A - Distributed generation method, device and computer storage medium by stages number - Google Patents

Distributed generation method, device and computer storage medium by stages number Download PDF

Info

Publication number
CN109165712A
CN109165712A CN201810867822.8A CN201810867822A CN109165712A CN 109165712 A CN109165712 A CN 109165712A CN 201810867822 A CN201810867822 A CN 201810867822A CN 109165712 A CN109165712 A CN 109165712A
Authority
CN
China
Prior art keywords
stages
installment
buffer area
staging
distributed
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201810867822.8A
Other languages
Chinese (zh)
Other versions
CN109165712B (en
Inventor
张本朋
李恩惠
孔之源
韩若飞
杨辉
彭雨
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Shanghai Pinwei Information Technology Co ltd
Original Assignee
Guangzhou Vipshop Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Guangzhou Vipshop Information Technology Co Ltd filed Critical Guangzhou Vipshop Information Technology Co Ltd
Priority to CN201810867822.8A priority Critical patent/CN109165712B/en
Publication of CN109165712A publication Critical patent/CN109165712A/en
Application granted granted Critical
Publication of CN109165712B publication Critical patent/CN109165712B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06KGRAPHICAL DATA READING; PRESENTATION OF DATA; RECORD CARRIERS; HANDLING RECORD CARRIERS
    • G06K19/00Record carriers for use with machines and with at least a part designed to carry digital markings
    • G06K19/06Record carriers for use with machines and with at least a part designed to carry digital markings characterised by the kind of the digital marking, e.g. shape, nature, code
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0633Managing shopping lists, e.g. compiling or processing purchase lists
    • G06Q30/0635Managing shopping lists, e.g. compiling or processing purchase lists replenishment orders; recurring orders

Landscapes

  • Business, Economics & Management (AREA)
  • Physics & Mathematics (AREA)
  • Accounting & Taxation (AREA)
  • Finance (AREA)
  • Theoretical Computer Science (AREA)
  • Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Development Economics (AREA)
  • General Business, Economics & Management (AREA)
  • Strategic Management (AREA)
  • Marketing (AREA)
  • Economics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

本发明公开了一种分布式分期号的生成方法,包括:在接收到获取分期号的请求时,根据所述请求携带的业务标识获取对应的分期号缓存区,其中,所述业务标识用以区分不同的业务,设置多个分期号缓存区用以对应各个业务;判断所述分期号缓存区是否为空;在所述分期号缓存区为空时,在数据库刷新所述分期号缓存区对应的数据以生成分期号;将所述分期号保存至所述分期号缓存区。本发明还公开了一种分布式分期号的生成装置和计算机存储介质,实现安全便捷的生成分期号以供对接的系统获取。

The invention discloses a method for generating a distributed installment number, comprising: when a request for obtaining a installment number is received, obtaining a corresponding installment number buffer area according to a service identifier carried in the request, wherein the service identifier is used for Distinguish different services, and set up multiple staging number cache areas to correspond to each service; determine whether the staging number cache area is empty; when the staging number cache area is empty, refresh the staging number cache area in the database corresponding to the to generate an installment number; save the installment number to the installment number buffer area. The invention also discloses a distributed installment number generating device and a computer storage medium, which realizes safe and convenient generation of installment numbers for acquisition by a docking system.

Description

Distributed generation method, device and computer storage medium by stages number
Technical field
The present invention relates to technical field of data processing more particularly to a kind of distributed generation method by stages number, device and Computer storage medium.
Background technique
Since the consumption pattern of bill by stages is generally risen in society now, therefore there are more people to use which branch It pays, correspondingly, request amount is also very more to the bill of each shopping website by stages, and increases with the increase of registered members.It is right In every bill information by stages, one is required in the Database Systems that table is divided in point library and number carries out unique business mark by stages. Generation by stages number should guarantee not impact existing service feature, also guarantee number in systems unique by stages Property, identifiability and safety.
To meet the requirements, it is current it is more commonly used be to use UUID as by stages number.UUID is by the 16 of one group of 32 digit Binary digits are constituted, and are combined by current time, clock sequence and globally unique machine recognition number (MAC Address of Network Card) It obtains.But using UUID, there are the following disadvantages:
Be not easy to store: UUID is too long, usually with the string representation of 32 bit lengths, stores and shows and is very inconvenient.Separately Outside, it is used as the unique ID of business by stages number, is to look for the important channel recorded by stages, UUID causes very big performance to ask data search Topic.
Information is dangerous: since UUID is generated based on MAC address of server, being likely to result in MAC address of server and lets out Dew, is unfavorable for server safety management.
Be easy to be imitated: UUID algorithm has been widely current now, is easy to be imitated by other people.
Summary of the invention
The main purpose of the present invention is to provide a kind of distributed generation method, device and computer storages by stages number to be situated between Matter, it is intended to solve traditional in payment transaction system, using UUID as bill, number there are dangerous and inconvenient by stages The technical issues of.
To achieve the above object, the present invention provides a kind of distributed generation method by stages number, it is described it is distributed by stages number Generation method comprising steps of
Receive obtain request by stages number when, according to the service identification that the request carries obtain it is corresponding by stages number Buffer area, wherein multiple number buffer areas by stages are arranged to each industry of correspondence to distinguish different business in the service identification Business;
Whether the judgement number buffer area by stages is empty;
When number buffer area by stages is empty, described in the database refresh by stages the corresponding data of number buffer area to generate By stages number;
By number preservation by stages to number buffer area by stages.
Preferably, the step of corresponding data of number buffer area are by stages to generate by stages number described in database refresh packet It includes:
Lock database simultaneously updates the currently stored corresponding ID of number buffer area by stages of the database, wherein institute The quantity by stages number for stating that ID indicates that presently described number buffer area by stages generated;
It obtains updated ID and discharges the locking of the database;
Digital encryption is carried out to the numerical value between the ID for updating front and back, wherein the numerical value between ID before and after the update It does not include the ID before updating, including updated ID;
Using the encrypted numerical value as by stages number.
Preferably, the lock database and to update the currently stored number buffer area by stages of the database corresponding The step of ID includes:
Lock database obtains the currently stored corresponding ID of number buffer area by stages of the database and present count Value, wherein the default value is to refresh the number amount by stages that number buffer area generates by stages every time;
Target id is calculated according to the ID and default value of acquisition;
Using Target id update prestore described in the corresponding ID of number buffer area by stages.
Preferably, the distributed generation method by stages number further include:
It is described number buffer area is not sky by stages when, obtained from number buffer area by stages by stages number.
Preferably, the distributed generation method by stages number further include:
When number buffer area by stages is empty, asking on the corresponding same node of number buffer area by stages is obtained It asks, wherein the corresponding business of number buffer area by stages uses distributed deployment, there is multiple operation nodes;
Obtain the single request thread that synchrolock is taken in the request;
Judge whether the corresponding number buffer area by stages of the single request thread is empty;
If number buffer area by stages is sky, the corresponding number of number buffer area by stages described in the database refresh is executed It generates accordingly by stages number, and the step of described number saving by stages to number buffer area by stages;
If number buffer area by stages be not it is empty, execute the step obtained from number buffer area by stages by stages number Suddenly.
Preferably, the distributed generation method by stages number further include:
The synchrolock of the single request thread is discharged, so that other threads of the request obtain the synchronization Lock.
In addition, to achieve the above object, the present invention also provides a kind of distributed generating means by stages number, the distributions Generating means by stages number include memory, processor and are stored on the memory and can run on the processor Computer program realizes generation by stages number as described above distributed when the computer program is executed by the processor The step of method.
In addition, to achieve the above object, the present invention also provides a kind of computer storage medium, the computer storage medium On be stored with distributed generation program by stages number, reality when the distributed generation program by stages number is executed by the processor The step of generation method by stages number now as described above distributed.
Distributed generation method, device and computer storage medium by stages number proposed by the present invention, obtains receiving When request by stages number, corresponding number buffer area by stages is obtained according to the service identification that the request carries, wherein the business To distinguish different business multiple number buffer areas by stages are arranged to each business of correspondence, then judgement is described by stages in mark Number buffer area whether be it is empty, when number buffer area by stages is empty, number buffer area is corresponding by stages described in the database refresh Data described number will be saved to number buffer area by stages by stages with generating by stages number, realize the generation of safe and convenient by stages Number for docking system obtain.
Detailed description of the invention
Fig. 1 is the terminal structure schematic diagram for the hardware running environment that the embodiment of the present invention is related to;
Fig. 2 is the flow diagram of the distributed generation method first embodiment by stages number of the present invention;
Fig. 3 is the frame diagram of the distributed generation method by stages number of the present invention;
Fig. 4 is the step of corresponding data of number buffer area is by stages to generate by stages number described in the database refresh in Fig. 2 Refine flow diagram;
Fig. 5 is the flow diagram of the distributed generation method 3rd embodiment by stages number of the present invention;
Fig. 6 is the flow diagram of the distributed generation method fourth embodiment by stages number of the present invention.
The embodiments will be further described with reference to the accompanying drawings for the realization, the function and the advantages of the object of the present invention.
Specific embodiment
It should be appreciated that the specific embodiments described herein are merely illustrative of the present invention, it is not intended to limit the present invention.
The primary solutions of the embodiment of the present invention are:
Receive obtain request by stages number when, according to the service identification that the request carries obtain it is corresponding by stages number Buffer area, wherein multiple number buffer areas by stages are arranged to each industry of correspondence to distinguish different business in the service identification Business;
Whether the judgement number buffer area by stages is empty;
When number buffer area by stages is empty, described in the database refresh by stages the corresponding data of number buffer area to generate By stages number;
By number preservation by stages to number buffer area by stages.
Due in the prior art, use UUID as by stages number, there is technical issues that it is dangerous, be not easy to.
The present invention provides a solution, receive obtain request by stages number when, carried according to the request Service identification obtains corresponding number buffer area by stages, wherein the service identification is arranged multiple points to distinguish different business Issue buffer area is to each business of correspondence, and then whether the judgement number buffer area by stages is sky, in number caching by stages When area is empty, the corresponding data of number buffer area and described number will be protected by stages by stages with generating by stages number described in the database refresh It deposits to number buffer area by stages, realizes the generation of safe and convenient by stages number so that the system of docking obtains.
As shown in Figure 1, Fig. 1 is the terminal structure schematic diagram for the hardware running environment that the embodiment of the present invention is related to.
The terminal of that embodiment of the invention is PC or server.
As shown in Figure 1, the terminal may include: processor 1001, such as CPU, network interface 1004, user interface 1003, memory 1005 and communication bus 1002.Wherein, communication bus 1002 is logical for realizing the connection between these components Letter.User interface 1003 may include display screen (Display), input unit such as keyboard (Keyboard), and optional user connects Mouth 1003 can also include standard wireline interface and wireless interface.Network interface 1004 optionally may include the wired of standard Interface, wireless interface (such as WI-FI interface).Memory 1005 can be high speed RAM memory, be also possible to stable memory (non-volatile memory), such as magnetic disk storage.Memory 1005 optionally can also be independently of aforementioned processor 1001 storage device.
It will be understood by those skilled in the art that the restriction of the not structure paired terminal of terminal structure shown in Fig. 1, can wrap It includes than illustrating more or fewer components, perhaps combines certain components or different component layouts.
As shown in Figure 1, as may include that operating system, network are logical in a kind of memory 1005 of computer storage medium Believe module, Subscriber Interface Module SIM and distributed generation program by stages number.
In terminal shown in Fig. 1, network interface 1004 is mainly used for connecting background server, carries out with background server Data communication;User interface 1003 is mainly used for connecting client (user terminal), carries out data communication with client;And processor 1001 can be used for calling the distributed generation program by stages number stored in memory 1005, and execute following operation:
Receive obtain request by stages number when, according to the service identification that the request carries obtain it is corresponding by stages number Buffer area, wherein multiple number buffer areas by stages are arranged to each industry of correspondence to distinguish different business in the service identification Business;
Whether the judgement number buffer area by stages is empty;
When number buffer area by stages is empty, described in the database refresh by stages the corresponding data of number buffer area to generate By stages number;
By number preservation by stages to number buffer area by stages.
Further, processor 1001 can call the distributed generation program by stages number stored in memory 1005, Also execute following operation:
Lock database simultaneously updates the currently stored corresponding ID of number buffer area by stages of the database, wherein institute The quantity by stages number for stating that ID indicates that presently described number buffer area by stages generated;
It obtains updated ID and discharges the locking of the database;
Digital encryption is carried out to the numerical value between the ID for updating front and back, wherein the numerical value between ID before and after the update It does not include the ID before updating, including updated ID;
Using the encrypted numerical value as by stages number.
Further, processor 1001 can call the distributed generation program by stages number stored in memory 1005, Also execute following operation:
Lock database obtains the currently stored corresponding ID of number buffer area by stages of the database and present count Value, wherein the default value is to refresh the number amount by stages that number buffer area generates by stages every time;
Target id is calculated according to the ID and default value of acquisition;
Using Target id update prestore described in the corresponding ID of number buffer area by stages.
Further, processor 1001 can call the distributed generation program by stages number stored in memory 1005, Also execute following operation:
It is described number buffer area is not sky by stages when, obtained from number buffer area by stages by stages number.
Further, processor 1001 can call the distributed generation program by stages number stored in memory 1005, Also execute following operation:
When number buffer area by stages is empty, asking on the corresponding same node of number buffer area by stages is obtained It asks, wherein the corresponding business of number buffer area by stages uses distributed deployment, there is multiple operation nodes;
Obtain the single request thread that synchrolock is taken in the request;
Judge whether the corresponding number buffer area by stages of the single request thread is empty;
If number buffer area by stages is sky, the corresponding number of number buffer area by stages described in the database refresh is executed It generates accordingly by stages number, and the step of described number saving by stages to number buffer area by stages;
If number buffer area by stages be not it is empty, execute the step obtained from number buffer area by stages by stages number Suddenly.
Further, processor 1001 can call the distributed generation program by stages number stored in memory 1005, Also execute following operation:
The synchrolock of the single request thread is discharged, so that other threads of the request obtain the synchronization Lock.
Referring to Fig. 2, Fig. 2 is the flow diagram of the distributed generation method first embodiment by stages number of the present invention;
The present embodiment proposes a kind of distributed generation method by stages number, and the generation method of distribution by stages number includes walking It is rapid:
Step S10, receive obtain request by stages number when, obtained and corresponded to according to the service identification that the request carries Number buffer area by stages, wherein multiple number buffer areas by stages are arranged to right to distinguish different business in the service identification Answer each business;
As shown in figure 3, each service is using distributed deployment, service described herein can be with for frame diagram of the invention One interface of system external offer is provided, a business of a system popular can also be interpreted as.The present embodiment In, corresponding number buffer area by stages is arranged to each service, to place by stages number.Receiving the request obtained by stages number When, which service the service identification judgement first carried according to the request belongs to, which can use according to specific business Different names has determined that corresponding number buffer area by stages after determining corresponding service.
Whether step S20, the judgement number buffer area by stages are empty;
Step S30, when number buffer area by stages is empty, the corresponding number of number buffer area by stages described in the database refresh It generates accordingly by stages number;
Step S40, by number preservation by stages to number buffer area by stages.
Judge that this by stages in number buffer area with the presence or absence of by stages number, if it exists by stages number, can be directly acquired;If it does not exist By stages number, that is, this number buffer area is sky by stages, at this time, it may be necessary in the database refresh corresponding data of number buffer area by stages To generate by stages number, specific implementation process elaborates in a second embodiment, wouldn't explain herein.In database refresh number After obtaining by stages number, these obtained number are back to corresponding number buffer area by stages by stages and are saved.
Further, multiple number buffer areas by stages are arranged to each business of correspondence, so that performance is fully able in the present invention Most of business scenarios are supported, and have higher transplantability using component of the invention, can be docked from different operation systems.
The distributed generation method by stages number that the present embodiment proposes, receive obtain request by stages number when, according to The service identification that the request carries obtains corresponding number buffer area by stages, wherein the service identification is different to distinguish Multiple number buffer areas by stages are arranged to each business of correspondence in business, and then whether the judgement number buffer area by stages is sky, When number buffer area by stages is empty, described in the database refresh by stages the corresponding data of number buffer area to generate by stages number, and It described number will save by stages to number buffer area by stages, and realize the generation of safe and convenient by stages number so that the system of docking obtains It takes.
Further, referring to Fig. 4, propose that the distributed generation method second by stages number of the present invention is real based on first embodiment Example is applied, in the present embodiment, the step S30 includes:
Step S31, lock database, obtain the currently stored corresponding ID of number buffer area by stages of the database and Default value, wherein the quantity by stages number that the ID indicates that presently described number buffer area by stages generated, the present count Value is the number amount by stages that number buffer area generates by stages of refreshing every time;
Step S32 calculates Target id according to the ID and default value of acquisition;
Step S33, using Target id update prestore described in the corresponding ID of number buffer area by stages;
Step S34 obtains updated ID and discharges the locking of the database;
Step S35 carries out digital encryption to the numerical value between the ID for updating front and back, wherein ID before and after the update it Between numerical value do not include ID, including updated ID before updating;
Step S36, using the encrypted numerical value as by stages number.
In the present embodiment, introduce how in the corresponding data of database refresh to generate by stages number.Firstly, it is each by stages number Buffer area is provided with corresponding ID and step-length, wherein the ID indicate it is current this by stages number buffer area generated by stages number Quantity, the step-length, a that is, default value, to refresh the number amount by stages that number buffer area generates by stages every time. The initial value of ID can be set as 0, that is, indicate that corresponding number buffer area by stages does not generate excessive issue also, the setting of step-length can be according to number Depending on the performance in library, and the operation system demand of docking.In addition, needing to pass through Pessimistic Locking in database refresh data Mode lock database, be to prevent multiple nodes of a service while while updating the same ID not will cause dirty data, because The multiple nodes serviced for one are the corresponding same number buffer areas by stages.That is, if two nodes of a service The same ID is updated simultaneously, then needs to be updated operation twice respectively, and updating for second is on the basis that first time updates Upper progress, the two is not in repetition.
For example, ID is 0, step-length 1000, lock database discharges database after ID is updated to 0+1000=1000 Locking.Then, to 1~1000, this 1000 numbers carry out digital encryption respectively, using 1000 numerical value obtained after encryption as This time refresh generate by stages number.It should be noted that encrypted string length can be with autonomous control, it so can be effective Prevent be not easy to store existing for UUID, information is dangerous and is easy the problem of being imitated.
It in technical solution disclosed in the present embodiment, is generated by stages number by digital encryption, so that is generated number both pacified by stages Full length again is controllable, convenient for storage.Further, since the corresponding ID of each number buffer area by stages and step-length difference, for different Service, obtains ID and step-length is mutually isolated, is independent of each other, and brushes newly generated number will not repeat by stages every time.
Further, referring to Fig. 5, propose that the present invention is distributed by stages number based on first to second embodiment any embodiment Generation method 3rd embodiment, in the present embodiment, the distributed generation method by stages number further include:
Step S50, it is described number buffer area is not sky by stages when, obtained from number buffer area by stages by stages number.
In technical solution disclosed in the present embodiment, after refreshing a database, it can obtain large number of number depositing by stages Storage, can be directly from buffer area in when number being also not run out by stages of number buffer area by stages into corresponding number buffer area by stages Take by stages number, only go database refresh again when buffer area number is used up by stages with obtain it is new by stages number, in this way, can be effective Mitigation database pressure, can also tolerate database short time delay machine situation.
Further, referring to Fig. 6, propose that the present invention is distributed by stages number based on first to second embodiment any embodiment Generation method fourth embodiment, in the present embodiment, the distributed generation method by stages number further include:
Step S60 is obtained when number buffer area by stages is empty in the corresponding same section of number buffer area by stages Request on point, wherein the corresponding business of number buffer area by stages uses distributed deployment, there is multiple operation nodes;
Step S70 obtains the single request thread that synchrolock is taken in the request;
Step S80 judges whether the corresponding number buffer area by stages of the single request thread is empty;
Step S30 executes number buffer area by stages described in the database refresh if number buffer area by stages is sky The step of corresponding data are to generate by stages number;
Step S40 executes described the step of described number saving by stages to number buffer area by stages;
Step S50, if number buffer area by stages is not empty, the execution acquisition point from number buffer area by stages The step of issue.
The present embodiment can be understood as the concrete condition of first embodiment, since each service is using distributed deployment , therefore will appear on an operation node of a service has the request thread of multiple acquisitions by stages number, at this point, same using thread Step lock mechanism ensures that every time the thread of synchrolock is taken in only processing, and synchrolock can be taken by only having a thread every time, His thread needs to wait until to remove contention synchrolock again after thread release synchrolock.In the present embodiment, method by stages number is generated It is identical with the first embodiment, details are not described herein.It should be noted that the present embodiment tell about be handle concurrent thread side Method is handled the single thread for possessing synchrolock in synchronized code block with ensureing.
In addition, synchrolock is discharged when detecting that the single thread for possessing synchrolock has had been processed, for obtaining by stages Number request other threads obtain synchrolock.
In technical solution disclosed in the present embodiment, using thread synchronization lock, database Pessimistic Locking, so that in refresh When generating by stages number, it is ensured that the case where correctness and uniqueness of data are not in data corruption and data redundancy.
In addition, the embodiment of the present invention also proposes a kind of distributed generating means by stages number, it is described it is distributed by stages number Generating means include memory, processor and are stored in the computer journey that can be run on the memory and on the processor Sequence, the computer program realize the generation method of distribution described in embodiment as above by stages number when being executed by the processor The step of.
In addition, the embodiment of the present invention also proposes a kind of computer storage medium, it is stored in the computer storage medium Distributed generation program by stages number, the distributed generation program by stages number are realized as above in fact when being executed by the processor The step of applying the generation method of distribution described in example by stages number.
It should be noted that, in this document, the terms "include", "comprise" or its any other variant are intended to non-row His property includes, so that the process, method, article or the device that include a series of elements not only include those elements, and And further include other elements that are not explicitly listed, or further include for this process, method, article or device institute it is intrinsic Element.In the absence of more restrictions, the element limited by sentence "including a ...", it is not excluded that including being somebody's turn to do There is also other identical elements in the process, method of element, article or device.
The serial number of the above embodiments of the invention is only for description, does not represent the advantages or disadvantages of the embodiments.
Through the above description of the embodiments, those skilled in the art can be understood that above-described embodiment side Method can be realized by means of software and necessary general hardware platform, naturally it is also possible to by hardware, but in many cases The former is more preferably embodiment.Based on this understanding, technical solution of the present invention substantially in other words does the prior art The part contributed out can be embodied in the form of software products, which is stored in one as described above In storage medium (such as ROM/RAM, magnetic disk, CD), including some instructions are used so that terminal device (it can be mobile phone, Computer, cloud server, air conditioner or network equipment etc.) method that executes each embodiment of the present invention.
The above is only a preferred embodiment of the present invention, is not intended to limit the scope of the invention, all to utilize this hair Equivalent structure or equivalent flow shift made by bright specification and accompanying drawing content is applied directly or indirectly in other relevant skills Art field, is included within the scope of the present invention.

Claims (8)

1.一种分布式分期号的生成方法,其特征在于,所述分布式分期号的生成方法包括步骤:1. a generation method of distributed installment number, is characterized in that, the generation method of described distributed installment number comprises the steps: 在接收到获取分期号的请求时,根据所述请求携带的业务标识获取对应的分期号缓存区,其中,所述业务标识用以区分不同的业务,设置多个分期号缓存区用以对应各个业务;When receiving the request for obtaining the installment number, obtain the corresponding installment number buffer area according to the service identifier carried in the request, wherein the service identifier is used to distinguish different services, and multiple installment number buffer areas are set to correspond to each business; 判断所述分期号缓存区是否为空;Determine whether the installment number buffer is empty; 在所述分期号缓存区为空时,在数据库刷新所述分期号缓存区对应的数据以生成分期号;When the staging number buffer is empty, refresh the data corresponding to the staging number buffer in the database to generate the staging number; 将所述分期号保存至所述分期号缓存区。Save the installment number to the installment number buffer area. 2.如权利要求1所述的分布式分期号的生成方法,其特征在于,所述在数据库刷新所述分期号缓存区对应的数据以生成分期号的步骤包括:2. the generation method of the distributed installment number as claimed in claim 1, is characterized in that, the described step of refreshing the data corresponding to the installment number buffer area in the database to generate the installment number comprises: 锁定数据库并更新所述数据库当前存储的所述分期号缓存区对应的ID,其中,所述ID表示当前所述分期号缓存区已生成过的分期号的数量;Lock the database and update the ID corresponding to the staging number cache area currently stored in the database, wherein the ID represents the number of staging numbers that the current staging number cache area has generated; 获取更新后的ID并释放所述数据库的锁定;Get the updated ID and release the lock on the database; 对更新前后的ID之间的数值进行数字加密,其中,所述更新前后的ID之间的数值不包括更新前的ID,包括更新后的ID;The numerical value between the IDs before and after the update is digitally encrypted, wherein the numerical value between the IDs before and after the update does not include the ID before the update, including the ID after the update; 将加密后的所述数值作为分期号。The encrypted value is used as the installment number. 3.如权利要求2所述的分布式分期号的生成方法,其特征在于,所述锁定数据库并更新所述数据库当前存储的所述分期号缓存区对应的ID的步骤包括:3. the generation method of distributed installment number as claimed in claim 2 is characterized in that, the step of described locking database and updating the ID corresponding to the described installment number cache area that described database currently stores comprises: 锁定数据库,获取所述数据库当前存储的所述分期号缓存区对应的ID和预设数值,其中,所述预设数值为每次刷新所述分期号缓存区生成的分期号数量;Lock the database, and obtain the ID and preset value corresponding to the staging number cache area currently stored in the database, wherein the preset value is the number of staging numbers generated by refreshing the staging number cache area each time; 根据获取的所述ID和预设数值计算目标ID;Calculate the target ID according to the obtained ID and the preset value; 采用所述目标ID更新预存的所述分期号缓存区对应的ID。The pre-stored ID corresponding to the staging number buffer area is updated by using the target ID. 4.如权利要求1所述的分布式分期号的生成方法,其特征在于,所述分布式分期号的生成方法还包括:4. the generation method of distributed installment number as claimed in claim 1 is characterized in that, the generation method of described distributed installment number also comprises: 在所述分期号缓存区不为空时,从所述分期号缓存区中获取分期号。When the instalment number buffer is not empty, the instalment number is acquired from the instalment number buffer. 5.如权利要求1所述的分布式分期号的生成方法,其特征在于,所述分布式分期号的生成方法还包括:5. the generation method of distributed installment number as claimed in claim 1 is characterized in that, the generation method of described distributed installment number also comprises: 在所述分期号缓存区为空时,获取在所述分期号缓存区对应的同一个节点上的请求,其中,所述分期号缓存区对应的业务采用分布式部署,有多个运行节点;When the staging number buffer area is empty, obtain a request on the same node corresponding to the staging number buffer area, wherein the service corresponding to the staging number buffer area adopts distributed deployment and has multiple running nodes; 获取所述请求中拿到同步锁的单个请求线程;Obtain the single request thread that obtained the synchronization lock in the request; 判断所述单个请求线程对应的分期号缓存区是否为空;Determine whether the staging number buffer area corresponding to the single request thread is empty; 若所述分期号缓存区为空,则执行所述在数据库刷新所述分期号缓存区对应的数据以生成分期号,以及将所述分期号保存至所述分期号缓存区的步骤;If the staging number buffer area is empty, then performing the steps of refreshing the data corresponding to the staging number buffer area in the database to generate the staging number, and saving the staging number to the staging number buffer area; 若所述分期号缓存区不为空,则执行所述从所述分期号缓存区中获取分期号的步骤。If the installment number buffer area is not empty, the step of obtaining the installment number from the installment number buffer area is performed. 6.如权利要求5所述的分布式分期号的生成方法,其特征在于,所述分布式分期号的生成方法还包括:6. the generation method of distributed installment number as claimed in claim 5 is characterized in that, the generation method of described distributed installment number also comprises: 释放所述单个请求线程的所述同步锁,以供所述请求的其他线程获取所述同步锁。The synchronization lock of the single requesting thread is released for other threads of the request to acquire the synchronization lock. 7.一种分布式分期号的生成装置,其特征在于,所述分布式分期号的生成装置包括存储器、处理器及存储在所述存储器上并可在所述处理器上运行的计算机程序,所述计算机程序被所述处理器执行时实现如权利要求1-6中任一项所述的分布式分期号的生成方法的步骤。7. the generation device of a distributed installment number, it is characterised in that the generation device of the distributed installment number comprises a memory, a processor and a computer program stored on the memory and can be run on the processor, The computer program, when executed by the processor, implements the steps of the method for generating a distributed installment number according to any one of claims 1-6. 8.一种计算机存储介质,其特征在于,所述计算机存储介质上存储有分布式分期号的生成程序,所述分布式分期号的生成程序被所述处理器执行时实现如权利要求1-6中任一项所述的分布式分期号的生成方法的步骤。8. a computer storage medium, it is characterised in that the computer storage medium is stored with the generation program of the distributed staging number, the generation program of the distributed staging number is implemented by the processor as claimed in claim 1- Steps of the method for generating a distributed installment number according to any one of 6.
CN201810867822.8A 2018-08-01 2018-08-01 Method, device and computer storage medium for generating distributed installment numbers Active CN109165712B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810867822.8A CN109165712B (en) 2018-08-01 2018-08-01 Method, device and computer storage medium for generating distributed installment numbers

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810867822.8A CN109165712B (en) 2018-08-01 2018-08-01 Method, device and computer storage medium for generating distributed installment numbers

Publications (2)

Publication Number Publication Date
CN109165712A true CN109165712A (en) 2019-01-08
CN109165712B CN109165712B (en) 2021-06-29

Family

ID=64898612

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810867822.8A Active CN109165712B (en) 2018-08-01 2018-08-01 Method, device and computer storage medium for generating distributed installment numbers

Country Status (1)

Country Link
CN (1) CN109165712B (en)

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125569A (en) * 2019-12-25 2020-05-08 北京同邦卓益科技有限公司 Data identifier generation method and device, electronic equipment and medium
CN112732760A (en) * 2021-01-07 2021-04-30 泰康保险集团股份有限公司 Distribution method, server and storage medium for report number under distributed environment
CN114363883A (en) * 2022-01-19 2022-04-15 东方通信股份有限公司 Roaming number function distributed deployment system
CN115080660A (en) * 2022-06-06 2022-09-20 中国银行股份有限公司 Method, device and system for acquiring sequence number in distributed system

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164418A (en) * 2011-12-12 2013-06-19 阿里巴巴集团控股有限公司 Method and device for processing serial numbers
CN103647833A (en) * 2013-12-16 2014-03-19 百度在线网络技术(北京)有限公司 Continuous sequence number generation system and continuous sequence number generation method
US20150161048A1 (en) * 2013-12-09 2015-06-11 PernixData, Inc. System and Method for Maintaining Cache Coherency
CN105404953A (en) * 2015-10-23 2016-03-16 努比亚技术有限公司 Identification generation method and apparatus
CN106911780A (en) * 2017-02-28 2017-06-30 北京三快在线科技有限公司 Traffic ID generation method, apparatus and system
CN107528816A (en) * 2016-06-22 2017-12-29 中兴通讯股份有限公司 ID processing method, management system and server in distributed data base

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN103164418A (en) * 2011-12-12 2013-06-19 阿里巴巴集团控股有限公司 Method and device for processing serial numbers
US20150161048A1 (en) * 2013-12-09 2015-06-11 PernixData, Inc. System and Method for Maintaining Cache Coherency
CN103647833A (en) * 2013-12-16 2014-03-19 百度在线网络技术(北京)有限公司 Continuous sequence number generation system and continuous sequence number generation method
CN105404953A (en) * 2015-10-23 2016-03-16 努比亚技术有限公司 Identification generation method and apparatus
CN107528816A (en) * 2016-06-22 2017-12-29 中兴通讯股份有限公司 ID processing method, management system and server in distributed data base
CN106911780A (en) * 2017-02-28 2017-06-30 北京三快在线科技有限公司 Traffic ID generation method, apparatus and system

Cited By (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111125569A (en) * 2019-12-25 2020-05-08 北京同邦卓益科技有限公司 Data identifier generation method and device, electronic equipment and medium
CN112732760A (en) * 2021-01-07 2021-04-30 泰康保险集团股份有限公司 Distribution method, server and storage medium for report number under distributed environment
CN114363883A (en) * 2022-01-19 2022-04-15 东方通信股份有限公司 Roaming number function distributed deployment system
CN114363883B (en) * 2022-01-19 2023-07-25 东方通信股份有限公司 Roaming number function distributed deployment system
CN115080660A (en) * 2022-06-06 2022-09-20 中国银行股份有限公司 Method, device and system for acquiring sequence number in distributed system

Also Published As

Publication number Publication date
CN109165712B (en) 2021-06-29

Similar Documents

Publication Publication Date Title
US12341872B2 (en) Hardware security module management
CN109165712A (en) Distributed generation method, device and computer storage medium by stages number
CN108897628A (en) A kind of implementation method of distributed lock, device and electronic equipment
WO2017185616A1 (en) File storage method and electronic equipment
CN109710695B (en) Transaction request validity identification and initiation method, device, equipment and medium
CN106802939B (en) A method and system for resolving data conflicts
CN111460474B (en) Method, device, memory and computer for implementing decentralization predictor
CN110830234A (en) User traffic distribution method and device
CN106790525A (en) File downloading method and device
CN107656750A (en) Update of plug-in method and device
CN107391539B (en) Transaction processing method, server and storage medium
CN112860953A (en) Data importing method, device, equipment and storage medium of graph database
CN106325936A (en) Rapid access method and rapid access system for application program
CN112256295A (en) Application program updating method, device, equipment and storage medium
CN111695124A (en) Authority control method and device, storage medium and electronic equipment
EP2874059A1 (en) Personal cloud storage chain service system and method
WO2022267769A1 (en) Method and apparatus for generating graph data
CN114064100A (en) Configuration information processing method, system and device
CN109951275A (en) Key generation method, device, computer equipment and storage medium
CN109818767B (en) A method, device and storage medium for adjusting the capacity of a Redis cluster
CN110960858A (en) Game resource processing method, device, equipment and storage medium
CN107430596A (en) The externalizing of Input Method Editor performs
CN112148287B (en) Dynamic table display method and device and electronic equipment
CN115114612A (en) Access processing method, apparatus, electronic device, and storage medium
JP2021149506A (en) Information processor, information processing method and program

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant
TR01 Transfer of patent right

Effective date of registration: 20221128

Address after: Room 902, No. 6, Lane 1588, Shenchang Road, Minhang District, Shanghai 201100

Patentee after: Shanghai Pinwei Information Technology Co.,Ltd.

Address before: 510000 building 1-5, No. 20, Huahai street, Fangcun, Liwan District, Guangzhou City, Guangdong Province

Patentee before: GUANGZHOU VIPSHOP INFORMATION TECHNOLOGY Co.,Ltd.

TR01 Transfer of patent right
点击 这是indexloc提供的php浏览器服务,不要输入任何密码和下载