CN109165712B - Method and device for generating distributed option number and computer storage medium - Google Patents

Method and device for generating distributed option number and computer storage medium Download PDF

Info

Publication number
CN109165712B
CN109165712B CN201810867822.8A CN201810867822A CN109165712B CN 109165712 B CN109165712 B CN 109165712B CN 201810867822 A CN201810867822 A CN 201810867822A CN 109165712 B CN109165712 B CN 109165712B
Authority
CN
China
Prior art keywords
cache region
stage
stage number
option
database
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.)
Active
Application number
CN201810867822.8A
Other languages
Chinese (zh)
Other versions
CN109165712A (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

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR 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; CALCULATING OR 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/0633Lists, e.g. purchase orders, compilation or processing
    • G06Q30/0635Processing of requisition or of purchase 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 type option number, which comprises the following steps: when a request for acquiring the stage number is received, acquiring a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, and a plurality of stage number cache regions are arranged to correspond to each service; judging whether the option number cache area is empty or not; when the stage number cache region is empty, refreshing data corresponding to the stage number cache region in a database to generate a stage number; and saving the stage number to the stage number cache region. The invention also discloses a device for generating the distributed option number and a computer storage medium, which can realize safe and convenient generation of the option number for the acquisition of a docking system.

Description

Method and device for generating distributed option number and computer storage medium
Technical Field
The present invention relates to the field of data processing technologies, and in particular, to a method and an apparatus for generating a distributed type issue number, and a computer storage medium.
Background
Because the current society generally arouses a consumption mode of bill staging, more people pay by adopting the mode, and correspondingly, the bill staging request quantity of each shopping website is very much and is increased along with the increase of registered members. For each bill staging information, a staging number is required to carry out unique service identification in a database system of the staging table. The generation of the option number ensures that the existing service performance is not influenced, and also ensures the uniqueness, identifiability and safety of the option number in the system.
To meet the requirements, it is currently more common to use UUIDs as the stage numbers. The UUID is composed of a set of 32-digit 16-ary digits and is obtained by combining the current time, a clock sequence and a globally unique machine identification number (network card MAC address). However, there are some disadvantages to using UUIDs as follows:
not easy to store: UUIDs are too long, usually expressed in strings of 32 bits in length, and are inconvenient to store and present. In addition, the stage number is used as a unique ID of the service, which is an important way for searching the stage record, and the UUID causes a great performance problem for data searching.
The information is unsafe: since the UUID is generated based on the server MAC address, the server MAC address may be leaked, which is not favorable for server security management.
Are easily simulated: the UUID algorithm is now widely popular and is easily imitated by others.
Disclosure of Invention
The invention mainly aims to provide a method and a device for generating a distributed type term number and a computer storage medium, and aims to solve the technical problems of insecurity and inconvenience in the traditional payment transaction system by using a UUID as a bill term number.
In order to achieve the above object, the present invention provides a method for generating a distributed type option number, where the method for generating a distributed type option number includes:
when a request for acquiring the stage number is received, acquiring a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, and a plurality of stage number cache regions are arranged to correspond to each service;
judging whether the option number cache area is empty or not;
when the stage number cache region is empty, refreshing data corresponding to the stage number cache region in a database to generate a stage number;
and saving the stage number to the stage number cache region.
Preferably, the step of refreshing the data corresponding to the option number buffer in the database to generate the option number includes:
locking a database and updating an ID corresponding to the stage number cache region currently stored in the database, wherein the ID represents the number of the stage numbers generated by the stage number cache region currently;
acquiring the updated ID and releasing the locking of the database;
digitally encrypting a numerical value between the IDs before and after updating, wherein the numerical value between the IDs before and after updating does not include the ID before updating and includes the ID after updating;
and taking the encrypted numerical value as an option number.
Preferably, the step of locking the database and updating the ID corresponding to the option number buffer currently stored in the database includes:
locking a database, and acquiring an ID (identity) and a preset numerical value corresponding to the stage number cache region currently stored in the database, wherein the preset numerical value is the number of the stage numbers generated by refreshing the stage number cache region each time;
calculating a target ID according to the obtained ID and a preset numerical value;
and updating the corresponding ID of the pre-stored option number cache region by adopting the target ID.
Preferably, the method for generating a distributed option number further includes:
and when the stage number cache region is not empty, acquiring the stage number from the stage number cache region.
Preferably, the method for generating a distributed option number further includes:
when the stage number cache region is empty, acquiring a request on the same node corresponding to the stage number cache region, wherein services corresponding to the stage number cache region are distributed and deployed and comprise a plurality of operating nodes;
acquiring a single request thread which takes the synchronous lock in the request;
judging whether the staging number cache region corresponding to the single request thread is empty or not;
if the stage number cache region is empty, executing the step of refreshing the data corresponding to the stage number cache region in the database to generate the stage number and storing the stage number in the stage number cache region;
and if the stage number cache region is not empty, executing the step of acquiring the stage number from the stage number cache region.
Preferably, the method for generating a distributed option number further includes:
releasing the synchronization lock of the single requesting thread for other threads of the request to acquire the synchronization lock.
In addition, to achieve the above object, the present invention further provides a device for generating a distributed option number, which includes a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein the computer program, when executed by the processor, implements the steps of the method for generating a distributed option number as described above.
Further, to achieve the above object, the present invention also provides a computer storage medium having stored thereon a distributed option number generation program that realizes the steps of the distributed option number generation method as described above when executed by the processor.
When receiving a request for acquiring the stage number, the method, the device and the computer storage medium for generating the distributed stage number acquire a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, a plurality of stage number cache regions are arranged to correspond to each service, then whether the stage number cache region is empty is judged, when the stage number cache region is empty, data corresponding to the stage number cache region is refreshed in a database to generate the stage number, and the stage number is stored in the stage number cache region, so that the safe and convenient generation of the stage number for the acquisition of a butt system is realized.
Drawings
Fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention;
fig. 2 is a schematic flow chart of a first embodiment of a method for generating a distributed option number according to the present invention;
FIG. 3 is a block diagram of a method for generating a distributed option number according to the present invention;
FIG. 4 is a schematic view of a detailed flow chart of a step of refreshing data corresponding to the option number buffer in the database in FIG. 2 to generate an option number;
fig. 5 is a flowchart illustrating a third embodiment of a method for generating a distributed type option number according to the present invention;
fig. 6 is a flowchart illustrating a fourth embodiment of a method for generating a distributed type option number according to the present invention.
The implementation, functional features and advantages of the objects of the present invention will be further explained with reference to the accompanying drawings.
Detailed Description
It should be understood that the specific embodiments described herein are merely illustrative of the invention and are not intended to limit the invention.
The main solution of the embodiment of the invention is as follows:
when a request for acquiring the stage number is received, acquiring a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, and a plurality of stage number cache regions are arranged to correspond to each service;
judging whether the option number cache area is empty or not;
when the stage number cache region is empty, refreshing data corresponding to the stage number cache region in a database to generate a stage number;
and saving the stage number to the stage number cache region.
Because the UUID is used as the stage number in the prior art, the technical problems of insecurity and difficulty in storage exist.
The invention provides a solution, when receiving a request for acquiring an option number, acquiring a corresponding option number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, a plurality of option number cache regions are arranged to correspond to each service, then judging whether the option number cache region is empty, when the option number cache region is empty, refreshing data corresponding to the option number cache region in a database to generate the option number, and storing the option number into the option number cache region, thereby realizing safe and convenient generation of the option number for a butt-joint system to acquire.
As shown in fig. 1, fig. 1 is a schematic terminal structure diagram of a hardware operating environment according to an embodiment of the present invention.
The terminal of the embodiment of the invention is a PC or a server.
As shown in fig. 1, the terminal may include: a processor 1001, such as a CPU, a network interface 1004, a user interface 1003, a memory 1005 and a communication bus 1002. Wherein a communication bus 1002 is used to enable connective communication between these components. The user interface 1003 may include a Display screen (Display), an input unit such as a Keyboard (Keyboard), and the optional user interface 1003 may also include a standard wired interface, a wireless interface. The network interface 1004 may optionally include a standard wired interface, a wireless interface (e.g., WI-FI interface). The memory 1005 may be a high-speed RAM memory or a non-volatile memory (e.g., a magnetic disk memory). The memory 1005 may alternatively be a storage device separate from the processor 1001.
Those skilled in the art will appreciate that the terminal structure shown in fig. 1 is not intended to be limiting and may include more or fewer components than those shown, or some components may be combined, or a different arrangement of components.
As shown in fig. 1, a memory 1005, which is a kind of computer storage medium, may include therein an operating system, a network communication module, a user interface module, and a generation program of a distributed option number.
In the terminal shown in fig. 1, the network interface 1004 is mainly used for connecting to a backend server and performing data communication with the backend server; the user interface 1003 is mainly used for connecting a client (user side) and performing data communication with the client; and the processor 1001 may be configured to call the generation program of the distributed option number stored in the memory 1005, and perform the following operations:
when a request for acquiring the stage number is received, acquiring a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, and a plurality of stage number cache regions are arranged to correspond to each service;
judging whether the option number cache area is empty or not;
when the stage number cache region is empty, refreshing data corresponding to the stage number cache region in a database to generate a stage number;
and saving the stage number to the stage number cache region.
Further, the processor 1001 may call the generation program of the distributed option number stored in the memory 1005, and also perform the following operations:
locking a database and updating an ID corresponding to the stage number cache region currently stored in the database, wherein the ID represents the number of the stage numbers generated by the stage number cache region currently;
acquiring the updated ID and releasing the locking of the database;
digitally encrypting a numerical value between the IDs before and after updating, wherein the numerical value between the IDs before and after updating does not include the ID before updating and includes the ID after updating;
and taking the encrypted numerical value as an option number.
Further, the processor 1001 may call the generation program of the distributed option number stored in the memory 1005, and also perform the following operations:
locking a database, and acquiring an ID (identity) and a preset numerical value corresponding to the stage number cache region currently stored in the database, wherein the preset numerical value is the number of the stage numbers generated by refreshing the stage number cache region each time;
calculating a target ID according to the obtained ID and a preset numerical value;
and updating the corresponding ID of the pre-stored option number cache region by adopting the target ID.
Further, the processor 1001 may call the generation program of the distributed option number stored in the memory 1005, and also perform the following operations:
and when the stage number cache region is not empty, acquiring the stage number from the stage number cache region.
Further, the processor 1001 may call the generation program of the distributed option number stored in the memory 1005, and also perform the following operations:
when the stage number cache region is empty, acquiring a request on the same node corresponding to the stage number cache region, wherein services corresponding to the stage number cache region are distributed and deployed and comprise a plurality of operating nodes;
acquiring a single request thread which takes the synchronous lock in the request;
judging whether the staging number cache region corresponding to the single request thread is empty or not;
if the stage number cache region is empty, executing the step of refreshing the data corresponding to the stage number cache region in the database to generate the stage number and storing the stage number in the stage number cache region;
and if the stage number cache region is not empty, executing the step of acquiring the stage number from the stage number cache region.
Further, the processor 1001 may call the generation program of the distributed option number stored in the memory 1005, and also perform the following operations:
releasing the synchronization lock of the single requesting thread for other threads of the request to acquire the synchronization lock.
Referring to fig. 2, fig. 2 is a schematic flow chart of a first embodiment of a method for generating a distributed option number according to the present invention;
the embodiment provides a method for generating a distributed type option number, which includes the steps of:
step S10, when receiving a request for obtaining the stage number, obtaining a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, and a plurality of stage number cache regions are arranged to correspond to each service;
the framework diagram of the present invention is shown in fig. 3, each service is deployed in a distributed manner, and the service described herein may be understood as an interface provided by a system to the outside, or may be understood as a service of a system in a popular manner. In this embodiment, a corresponding extension number buffer is set for each service to place an extension number. When a request for acquiring the stage number is received, the service identifier carried by the request is used for judging which service belongs to, the service identifier can use different names according to specific services, and after the corresponding service is determined, the corresponding stage number cache region is determined.
Step S20, judging whether the option number buffer area is empty;
step S30, when the stage number buffer area is empty, refreshing the data corresponding to the stage number buffer area in the database to generate the stage number;
and step S40, storing the stage number to the stage number buffer area.
Judging whether the stage number exists in the stage number cache region, if so, directly obtaining the stage number; if there is no epoch number, that is, the epoch number cache region is empty, at this time, the database needs to refresh the data corresponding to the epoch number cache region to generate the epoch number. After the database refreshes the data and obtains the stage numbers, returning the obtained stage numbers to the corresponding stage number cache region and storing the stage numbers.
Furthermore, the invention sets a plurality of option number cache regions to correspond to each service, so that the performance can completely support most service scenes, and the component applying the invention has higher portability and can be butted with different service systems.
In the method for generating a distributed option number provided in this embodiment, when a request for acquiring an option number is received, a corresponding option number cache region is acquired according to a service identifier carried in the request, where the service identifier is used to distinguish different services, a plurality of option number cache regions are set to correspond to each service, and then it is determined whether the option number cache region is empty, and when the option number cache region is empty, data corresponding to the option number cache region is refreshed in a database to generate an option number, and the option number is stored in the option number cache region, so that a safe and convenient generation of an option number for a docked system to acquire is achieved.
Further, referring to fig. 4, a second embodiment of the method for generating a distributed option number according to the present invention is proposed based on the first embodiment, and in this embodiment, the step S30 includes:
step S31, locking the database, and obtaining an ID and a preset value corresponding to the installment number buffer area currently stored in the database, where the ID represents the number of installment numbers generated by the installment number buffer area currently, and the preset value is the number of installment numbers generated by refreshing the installment number buffer area each time;
step S32, calculating a target ID according to the obtained ID and a preset numerical value;
step S33, updating the pre-stored ID corresponding to the stage number cache region by using the target ID;
step S34, acquiring the updated ID and releasing the lock of the database;
step S35, digitally encrypting a numerical value between the IDs before and after updating, wherein the numerical value between the IDs before and after updating does not include the ID before updating, and includes the ID after updating;
and step S36, taking the encrypted numerical value as the option number.
In this embodiment, how to refresh the corresponding data in the database to generate the term number is described. First, each term cache region is provided with a corresponding ID and a step size, where the ID represents the number of term numbers that have been generated by the term cache region currently, and the step size, that is, a preset value, is the number of term numbers generated by refreshing the term cache region each time. The initial value of ID may be set to 0, which means that the corresponding staging number buffer has not generated the staging number, and the setting of the step size may be determined according to the performance of the database and the requirements of the service system to be docked. In addition, when the database refreshes data, the database needs to be locked in a pessimistic lock mode, so that dirty data cannot be caused when a plurality of nodes of one service update the same ID at the same time, because the plurality of nodes of one service correspond to the same phase number cache region. That is, if two nodes of a service update the same ID at the same time, two update operations are required, and the second update is performed on the basis of the first update, so that the two update operations do not overlap.
For example, if the ID is 0, the step size is 1000, and the locking database releases the locking of the database after updating the ID to 0+1000 to 1000. Then, the 1000 numbers 1-1000 are respectively digitally encrypted, and the 1000 numerical values obtained after encryption are used as the stage numbers generated by the refreshing. It should be noted that the length of the encrypted character string can be controlled autonomously, so that the problems of difficult storage, unsafe information and easy emulation of the UUID can be effectively prevented.
In the technical scheme disclosed in the embodiment, the generated stage number is generated by digitally encrypting, so that the generated stage number is safe, controllable in length and convenient to store. In addition, because the corresponding ID and step length of each stage number cache region are different, the obtained ID and step length are mutually isolated and do not influence each other for different services, and the stage numbers generated by each refreshing can not be repeated.
Further, referring to fig. 5, a third embodiment of the method for generating a distributed option number according to the present invention is provided based on any one of the first to second embodiments, and in this embodiment, the method for generating a distributed option number further includes:
and step S50, when the stage number buffer area is not empty, acquiring the stage number from the stage number buffer area.
In the technical scheme disclosed in this embodiment, after the database is refreshed once, a large number of stage numbers can be obtained and stored in the corresponding stage number cache region, when the stage numbers in the stage number cache region are not used up, the stage numbers can be directly taken out from the cache region, and the database is refreshed only when the stage numbers in the cache region are used up to obtain new stage numbers, so that the pressure of the database can be effectively reduced, and the condition that the database is down in a short time can be tolerated.
Further, referring to fig. 6, a fourth embodiment of the method for generating a distributed option number according to the present invention is provided based on any one of the first to second embodiments, and in this embodiment, the method for generating a distributed option number further includes:
step S60, when the stage number cache region is empty, acquiring a request on the same node corresponding to the stage number cache region, wherein the service corresponding to the stage number cache region adopts distributed deployment and has a plurality of operation nodes;
step S70, obtaining a single request thread taking the synchronous lock in the request;
step S80, judging whether the staging number buffer zone corresponding to the single request thread is empty;
step S30, if the phase number buffer is empty, executing the step of refreshing the data corresponding to the phase number buffer in the database to generate the phase number;
step S40, executing the step of saving the installment number to the installment number buffer area;
step S50, if the installment number buffer is not empty, the step of obtaining the installment number from the installment number buffer is executed.
It can be understood that, as the specific case of the first embodiment, since each service is deployed in a distributed manner, a plurality of request threads for acquiring a stage number may be provided on one running node of one service, at this time, it is ensured by using a thread synchronization lock mechanism that only threads that get synchronization locks are processed each time, only one thread may get synchronization locks each time, and other threads need to contend for synchronization locks after the thread releases the synchronization locks. In this embodiment, the method for generating the term number is the same as that in the first embodiment, and is not described herein again. It should be noted that the present embodiment describes a method for processing concurrent threads to ensure that a single thread with a synchronization lock is processed in a synchronization code block.
Further, upon detecting that a single thread owning the synchronization lock has been processed, the synchronization lock is released for other threads acquiring the staging number request to acquire the synchronization lock.
In the technical scheme disclosed by the embodiment, the thread synchronization lock and the database pessimistic lock are utilized, so that when the generation term number of the database is refreshed, the correctness and uniqueness of data can be ensured, and the situations of data confusion and data redundancy can be avoided.
Furthermore, an embodiment of the present invention further provides an apparatus for generating a distributed option number, where the apparatus for generating a distributed option number includes a memory, a processor, and a computer program stored in the memory and executable on the processor, and when the computer program is executed by the processor, the steps of the method for generating a distributed option number according to the above embodiment are implemented.
Furthermore, an embodiment of the present invention further provides a computer storage medium, where a program for generating a distributed option number is stored, and when executed by the processor, the program for generating a distributed option number implements the steps of the method for generating a distributed option number according to the above embodiment.
It should be noted that, in this document, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other like elements in a process, method, article, or apparatus that comprises the element.
The above-mentioned serial numbers of the embodiments of the present invention are merely for description and do not represent the merits of the embodiments.
Through the above description of the embodiments, those skilled in the art will clearly understand that the method of the above embodiments can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware, but in many cases, the former is a better implementation manner. Based on such understanding, the technical solutions of the present invention may be substantially or partially embodied in the form of a software product, where the computer software product is stored in a storage medium (e.g., ROM/RAM, magnetic disk, optical disk) as described above, and includes several instructions for enabling a terminal device (e.g., a mobile phone, a computer, a cloud server, an air conditioner, or a network device) to execute the method of the embodiments of the present invention.
The above description is only a preferred embodiment of the present invention, and not intended to limit the scope of the present invention, and all modifications of equivalent structures and equivalent processes, which are made by using the contents of the present specification and the accompanying drawings, or directly or indirectly applied to other related technical fields, are included in the scope of the present invention.

Claims (6)

1. A method for generating a distributed option number is characterized in that the method for generating the distributed option number comprises the following steps:
when a request for acquiring the stage number is received, acquiring a corresponding stage number cache region according to a service identifier carried by the request, wherein the service identifier is used for distinguishing different services, and a plurality of stage number cache regions are arranged to correspond to each service;
judging whether the option number cache area is empty or not;
when the stage number cache region is empty, refreshing data corresponding to the stage number cache region in a database to generate a stage number;
saving the stage number to the stage number cache region;
the method for generating the distributed option number further comprises the following steps:
when the stage number cache region is empty, acquiring a request on the same node corresponding to the stage number cache region, wherein services corresponding to the stage number cache region are distributed and deployed and comprise a plurality of operating nodes;
acquiring a single request thread which takes the synchronous lock in the request;
judging whether the staging number cache region corresponding to the single request thread is empty or not;
if the stage number cache region is empty, executing the step of refreshing the data corresponding to the stage number cache region in the database to generate the stage number and storing the stage number in the stage number cache region;
if the staging number cache area is not empty, executing the step of acquiring the staging number from the staging number cache area;
wherein the step of refreshing the data corresponding to the option number cache region in the database to generate the option number comprises:
locking a database and updating an ID corresponding to the stage number cache region currently stored in the database, wherein the ID represents the number of the stage numbers generated by the stage number cache region currently;
acquiring the updated ID and releasing the locking of the database;
digitally encrypting a numerical value between the IDs before and after updating, wherein the numerical value between the IDs before and after updating does not include the ID before updating and includes the ID after updating;
and taking the encrypted numerical value as an option number.
2. The method for generating a distributed option number according to claim 1, wherein the step of locking the database and updating the ID corresponding to the option number buffer currently stored in the database comprises:
locking a database, and acquiring an ID (identity) and a preset numerical value corresponding to the stage number cache region currently stored in the database, wherein the preset numerical value is the number of the stage numbers generated by refreshing the stage number cache region each time;
calculating a target ID according to the obtained ID and a preset numerical value;
and updating the corresponding ID of the pre-stored option number cache region by adopting the target ID.
3. The method of generating a distributed option number according to claim 1, wherein the method of generating a distributed option number further comprises:
and when the stage number cache region is not empty, acquiring the stage number from the stage number cache region.
4. The method of generating a distributed option number according to claim 3, wherein the method of generating a distributed option number further comprises:
releasing the synchronization lock of the single requesting thread for other threads of the request to acquire the synchronization lock.
5. An apparatus for generating a distributed option number, the apparatus comprising a memory, a processor and a computer program stored on the memory and operable on the processor, the computer program, when executed by the processor, implementing the steps of the method for generating a distributed option number according to any one of claims 1-4.
6. A computer storage medium, characterized in that the computer storage medium has stored thereon a generation program of a distributed option number, which when executed by a processor implements the steps of the generation method of a distributed option number according to any one of claims 1 to 4.
CN201810867822.8A 2018-08-01 2018-08-01 Method and device for generating distributed option number and computer storage medium Active CN109165712B (en)

Priority Applications (1)

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

Applications Claiming Priority (1)

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

Publications (2)

Publication Number Publication Date
CN109165712A CN109165712A (en) 2019-01-08
CN109165712B true 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 and device for generating distributed option number and computer storage medium

Country Status (1)

Country Link
CN (1) CN109165712B (en)

Families Citing this family (3)

* 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
CN114363883B (en) * 2022-01-19 2023-07-25 东方通信股份有限公司 Roaming number function distributed deployment system

Citations (5)

* 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
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

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US9489389B2 (en) * 2013-12-09 2016-11-08 PernixData, Inc. System and method for maintaining cache coherency

Patent Citations (5)

* 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
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

Also Published As

Publication number Publication date
CN109165712A (en) 2019-01-08

Similar Documents

Publication Publication Date Title
US10523705B2 (en) Password breach registry
US10664613B2 (en) Virtualization input component
US10083311B2 (en) Cryptographic key
CN109165712B (en) Method and device for generating distributed option number and computer storage medium
US10659226B2 (en) Data encryption method, decryption method, apparatus, and system
US9699149B2 (en) Collision avoidance in a distributed tokenization environment
US10019596B2 (en) Collision avoidance in a distributed tokenization environment
WO2015101320A1 (en) Account number generation method, terminal and background server
CN106802939B (en) Method and system for solving data conflict
CN107040520B (en) Cloud computing data sharing system and method
CN107844488B (en) Data query method and device
CN111597567A (en) Data processing method, data processing device, node equipment and storage medium
CN113806031A (en) Method and apparatus for securing resources through object locks
CN110945506B (en) Searchable encryption supporting hybrid indexes
CN105678197A (en) Client data saving method and mobile terminal
CN109711193B (en) Storage space sharing method and device
CN108667647B (en) Method and device for setting device parameters and server
CN109710609A (en) Generate the method and device of tables of data mark
WO2020147590A1 (en) Screen unlocking method and apparatus, and computer device and storage medium
CN109885622B (en) Data processing equipment, system and multi-node data processing method
US9184996B2 (en) Thin client system, management server, client environment management method and program
CN113031989A (en) Method and device for realizing customized version of BIOS Setup setting item
US20140082700A1 (en) Information processing apparatus, authentication system, authentication method, and program
JP5854070B2 (en) Access control device, terminal device, and program
TW201941561A (en) Method and apparatus for managing passwords, and computer storage medium

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
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.