CN114218281A - Method and device for generating unique identification number - Google Patents

Method and device for generating unique identification number Download PDF

Info

Publication number
CN114218281A
CN114218281A CN202111553139.5A CN202111553139A CN114218281A CN 114218281 A CN114218281 A CN 114218281A CN 202111553139 A CN202111553139 A CN 202111553139A CN 114218281 A CN114218281 A CN 114218281A
Authority
CN
China
Prior art keywords
unique identification
identification number
generation
server
record
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.)
Pending
Application number
CN202111553139.5A
Other languages
Chinese (zh)
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.)
CCB Finetech Co Ltd
Original Assignee
CCB Finetech 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 CCB Finetech Co Ltd filed Critical CCB Finetech Co Ltd
Priority to CN202111553139.5A priority Critical patent/CN114218281A/en
Publication of CN114218281A publication Critical patent/CN114218281A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2455Query execution
    • G06F16/24552Database cache management

Landscapes

  • Engineering & Computer Science (AREA)
  • Databases & Information Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a method and a device for generating a unique identification number, which are applied to the technical field of big data intelligent analysis, and the method comprises the following steps: acquiring a generation record of the unique identification number; determining the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number; sending a generation request of the unique identification number to a server, wherein the generation request comprises a value range of the unique identification number; and receiving a plurality of unique identification numbers in the value range of the unique identification number sent by the server. By the method, the terminal equipment acquires the plurality of unique identification numbers within the value range of the unique identification number each time, so that the processing pressure of the server in generating the unique identification numbers is reduced, and the influence on the concurrency performance is reduced.

Description

Method and device for generating unique identification number
Technical Field
The invention relates to the technical field of big data intelligent analysis, in particular to a method and a device for generating a unique identification number.
Background
With the development of information technology, the application range of various applications is more and more. In a banking service system, an application can apply for a unique identification number from a database in a server, thereby performing various businesses such as transfer, inquiry and the like.
In the related art, the uniqueness of the unique identification number is generally ensured by using an Identity document (id) of a database. When the application program needs to generate the unique identification number, a generation request can be sent to the database, so that the database is requested to generate a latest id value of the unique identification number according to the self-id adding mode.
However, when the application is used in a large scale, for example, thousands of services are run at the same time, the application needs to send a generation request to the database once every time the application acquires a unique identification number, which causes a large processing pressure on the database.
Disclosure of Invention
The embodiment of the application provides a method and a device for generating a unique identification number, so as to solve the technical problem of high processing pressure of a database in the prior art.
In a first aspect, an embodiment of the present application provides a method for generating a unique identification number, which is applied to a terminal device, and the method includes:
acquiring a generation record of the unique identification number;
determining the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number;
sending a generation request of the unique identification number to a server, wherein the generation request comprises a value range of the unique identification number;
and receiving a plurality of unique identification numbers in the value range of the unique identification numbers sent by the server.
In an optional implementation manner, the generation record of the unique identification number includes a value of a newly generated unique identification number.
In an optional embodiment, the obtaining a record of generation of the unique identification number includes:
sending a reading request of the generated record of the unique identification number to the server;
and receiving the generation record of the unique identification number sent by the server.
In an optional embodiment, before the obtaining the generated record of the unique identification number, the method further includes:
receiving an acquisition request of the unique identification number sent by a target application;
determining whether at least one unused unique identification number exists in a local cache;
and if not, sending a reading request of the generated record of the unique identification number to the server.
In an optional embodiment, after the determining whether there is at least one unused unique identification number in the local cache, the method further comprises:
and if so, determining the unique identification number to be acquired by the target application from the at least one unused unique identification number according to the using sequence of the unique identification number.
In an optional implementation manner, after the receiving a plurality of unique identification numbers within a value range of the unique identification number sent by the server, the method further includes:
storing the plurality of unique identification numbers in a local cache;
and determining the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the using sequence of the unique identification numbers.
In a second aspect, an embodiment of the present application provides a method for generating a unique identification number, which is applied to a server, and the method includes:
receiving a generation request of the unique identification number sent by the terminal equipment, wherein the generation request comprises a value range of the unique identification number;
generating a plurality of unique identification numbers in the value range of the unique identification numbers;
and sending the plurality of unique identification numbers to the terminal equipment.
In an optional implementation manner, before the receiving the request for generating the unique identification number sent by the terminal device, the method further includes:
receiving a reading request of the generating record of the unique identification number sent by the terminal equipment;
and sending the generated record of the unique identification number to the terminal equipment.
In an optional implementation manner, the generation record of the unique identification number includes a value of a newly generated unique identification number;
after the sending the plurality of unique identification numbers to the terminal device, the method further comprises:
and updating the value of the newly generated unique identification number in the generation record of the unique identification number according to the value range of the unique identification number in the generation request.
In an alternative embodiment, the server performs concurrent control of multi-thread synchronization when generating the unique identification number.
In a third aspect, an embodiment of the present application provides an apparatus for generating a unique identification number, where the apparatus includes:
the processing module is used for acquiring the generation record of the unique identification number; determining the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number;
the sending module is used for sending a generation request of the unique identification number to a server, wherein the generation request comprises a value range of the unique identification number;
and the receiving module is used for receiving the plurality of unique identification numbers in the value range of the unique identification numbers sent by the server.
In an optional implementation manner, the generation record of the unique identification number includes a value of a newly generated unique identification number.
In an optional implementation manner, the sending module is further configured to send a read request of the generated record of the unique identification number to the server;
the receiving module is further configured to receive a generation record of the unique identification number sent by the server.
In an optional implementation manner, before the generating record of obtaining the unique identification number, the receiving module is further configured to receive an obtaining request of the unique identification number sent by a target application;
the processing module is further configured to determine whether at least one unused unique identification number exists in the local cache;
and the sending module is further used for sending a reading request of the record generation of the unique identification number to the server if the unique identification number is not the unique identification number.
In an optional implementation manner, if yes, the processing module is further configured to determine, according to a usage sequence of the unique identification numbers, a unique identification number to be acquired by the target application from the at least one unused unique identification number.
In an optional implementation manner, the processing module is further configured to store the plurality of unique identification numbers in a local cache; and determining the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the using sequence of the unique identification numbers.
In a fourth aspect, an embodiment of the present application provides an apparatus for generating a unique identification number, where the apparatus includes:
the receiving module is used for receiving a generation request of the unique identification number sent by the terminal equipment, wherein the generation request comprises a value range of the unique identification number;
the processing module is used for generating a plurality of unique identification numbers in the value range of the unique identification numbers;
and the sending module is used for sending the plurality of unique identification numbers to the terminal equipment.
In an optional implementation manner, the receiving module is further configured to receive a read request for generating a record of the unique identification number, where the read request is sent by the terminal device;
the sending module is further configured to send the generation record of the unique identification number to the terminal device.
In an optional implementation manner, the generation record of the unique identification number includes a value of a newly generated unique identification number;
and the processing module is further configured to update the value of the newly generated unique identification number in the generation record of the unique identification number according to the value range of the unique identification number in the generation request.
In an alternative embodiment, the apparatus performs concurrent control of multi-thread synchronization when generating the unique identification number.
In a fifth aspect, an embodiment of the present application provides a terminal device, including: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method according to the first aspect.
In a sixth aspect, an embodiment of the present application provides a server, including: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method according to the second aspect.
In a seventh aspect, the present application also provides a computer program product comprising a computer program that, when executed by a processor, performs the method of any one of the first aspect.
In an eighth aspect, the present application also provides a computer program product comprising a computer program that, when executed by a processor, performs the method of any one of the second aspects.
In a ninth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program of instructions for implementing any one of the possible methods of the first aspect when executed by a processor.
In a tenth aspect, the present invention also provides a non-transitory computer readable storage medium having stored thereon a computer program of instructions for implementing any one of the possible methods of the second aspect when executed by a processor.
According to the method and the device for generating the unique identification number, the terminal equipment firstly obtains the generation record of the unique identification number. And secondly, the terminal equipment determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number. And thirdly, the terminal equipment sends a generation request of the unique identification number to the server, wherein the generation request comprises the value range of the unique identification number. And finally, the terminal equipment receives the plurality of unique identification numbers in the value range of the unique identification numbers sent by the server. Different from the prior art that a unique identification number is applied to a server every time, the method and the device avoid the terminal equipment from frequently applying the unique identification number to the server and reduce the processing pressure of the server when generating the unique identification number by applying a plurality of unique identification numbers within a range to the server every time. Meanwhile, the influence on the concurrency performance can be reduced through the generation record of the unique identification number, and the uniqueness of the unique identification number is ensured.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the following briefly introduces the drawings needed to be used in the description of the embodiments or the prior art, and obviously, the drawings in the following description are some embodiments of the present invention, and those skilled in the art can obtain other drawings according to the drawings without inventive labor.
Fig. 1 is a schematic view of an application scenario of a method for generating a unique identification number according to an embodiment of the present application;
fig. 2 is a signaling interaction diagram of a method for generating a unique identification number according to an embodiment of the present application;
fig. 3 is a schematic diagram illustrating generation of a unique identification number according to an embodiment of the present application;
fig. 4 is a signaling interaction diagram of another unique identification number generation method according to an embodiment of the present application;
fig. 5 is a signaling interaction diagram of another unique identification number generation method according to an embodiment of the present application;
fig. 6 is a schematic structural diagram of a unique identification number generation apparatus according to an embodiment of the present application;
fig. 7 is a schematic structural diagram of another unique identification number generation apparatus according to an embodiment of the present application;
fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.
According to the technical scheme, the data acquisition, storage, use, processing and the like meet relevant regulations of national laws and regulations.
With the development of information technology, the application range of various applications is more and more. In a banking service system, an application can apply for a unique identification number from a database in a server, thereby performing various businesses such as transfer, inquiry and the like.
In the related art, two ways are generally adopted to ensure the uniqueness of the unique identification number. In the first mode, the uniqueness of the unique identification number can be ensured by a database self-increment id mode. When the application program needs to generate the unique identification number, a generation request can be sent to the database, so that the database is requested to generate a latest id value of the unique identification number according to the self-id adding mode. In the second way, a generation mode of a Universal Unique Identifier (UUID) and a related variant of the UUID can be adopted as the Unique identification number to ensure the uniqueness of the Unique identification number.
However, when the first method is used, if the application is used in a large scale, for example, thousands of services are run at the same time, the application sends a generation request to the database once every time the application acquires the unique identification number, so that the processing pressure of the database is large, and the concurrency performance is affected. When the second method is used, since the UUID appears similar to unordered letters, the approximate location of the UUID cannot be seen from the unique identification number, and the storage space of the UUID as a character string in the database and the retrieval efficiency are adversely affected.
In order to solve the above problem, an embodiment of the present application provides a method for generating a unique identification number, where a terminal device applies for a plurality of unique identification numbers in a value range from a server each time, so that a unique identification number with high readability can be generated efficiently without increasing database pressure in the server under a high concurrency condition. And moreover, the retrieval efficiency is not influenced, and the generation requirements of all unique identification numbers of the whole platform can be supported.
An application scenario of the method for generating a unique identification number according to the present application will be described below.
Fig. 1 is a schematic application scenario diagram of a method for generating a unique identification number according to an embodiment of the present application. As shown in fig. 1, when an application in the terminal device 101 needs to generate a unique identification number, it may be determined whether an unused unique identification number exists in the local cache first, and if an unused unique identification number exists in the local cache, the unused unique identification number may be directly taken from the local cache. If the unused unique identification number does not exist in the local cache, the generation record of the unique identification number can be acquired from the database of the server 102, and the value range of the unique identification number is determined according to the generation record of the unique identification number and the target generation number of the unique identification number, so that a plurality of unique identification numbers in the value range are applied to the database of the server 102 based on the value range of the unique identification number.
The terminal device 101 may be a tablet computer (pad), a computer with a wireless transceiving function, a Virtual Reality (VR) terminal device, an Augmented Reality (AR) terminal device, a wireless terminal in industrial control (industrial control), a wireless terminal in unmanned driving (self driving), a wireless terminal in remote surgery (remote medical supply), a wireless terminal in smart grid (smart grid), a wireless terminal in smart home (smart home), and the like. In the embodiment of the present application, the apparatus for implementing the function of the terminal may be the terminal, or may be an apparatus capable of supporting the terminal to implement the function, such as a chip system, and the apparatus may be installed in the terminal. In the embodiment of the present application, the chip system may be composed of a chip, and may also include a chip and other discrete devices.
Server 102 may be, but is not limited to, a single web server, a server farm of multiple web servers, or a cloud of numerous computers or web servers based on cloud computing. Cloud computing is a kind of distributed computing, and is a super virtual computer composed of a group of loosely coupled computers.
It should be understood that the application scenario of the technical solution of the present application may be the scenario in fig. 1, but is not limited to this, and may also be applied to other scenarios requiring generation of a unique identification number.
It can be understood that the method for generating the unique identification number can be implemented by the device for generating the unique identification number provided in the embodiment of the present application, and the device for generating the unique identification number may be part or all of a certain device, such as a terminal device and a server.
The technical solutions of the embodiments of the present disclosure are described in detail below with specific examples. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 2 is a signaling interaction diagram of a method for generating a unique identification number according to an embodiment of the present application, and this embodiment relates to a specific process of how to generate a unique identification number. As shown in fig. 2, the method includes:
s201, the terminal equipment acquires the generation record of the unique identification number.
In this embodiment of the application, when a target application in a terminal device needs to generate a unique identification number, the terminal device may obtain a generation record of the unique identification number.
The generation record of the unique identification number may include a value of the newly generated unique identification number.
In some embodiments, the terminal device may send a request for reading the generated record of the unique identification number to the server, so as to receive the generated record of the unique identification number sent by the server.
For example, the record of the generation of the unique identification number may be maintained by a database in the server, and the value N of the unique identification number that has been currently generated is recorded through a table. The database in the server maintains different generation records for different unique identification numbers, thereby avoiding interaction.
In some embodiments, if the terminal device receives an acquisition request of a unique identification number sent by a target application, before acquiring a generated record of the unique identification number, the terminal device may further determine whether at least one unused unique identification number exists in a local cache. If at least one unused unique identification number does not exist in the local cache, the terminal equipment can send a read request of generating a record of the unique identification number to the server again. If the local cache has at least one unused unique identification number, the terminal equipment determines the unique identification number to be acquired by the target application from the at least one unused unique identification number according to the use sequence of the unique identification numbers.
It should be understood that the embodiment of the present application is not limited to a target application, and may be any application that needs to generate a unique identification number. The application embodiment does not limit the use sequence of the unique identification number, and the use sequence can be the size sequence of a natural number.
For example, if the local cache includes unused unique identification numbers N to N + k, the terminal device may take N as the unique identification number to be acquired by the target application according to a size order of the natural numbers.
S202, the terminal equipment determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number.
In this step, after the terminal device obtains the generation record of the unique identification number, the value range of the unique identification number can be determined according to the generation record of the unique identification number and the target generation number of the unique identification number.
It should be understood that, in the embodiment of the present application, the target generation number of the unique identification number is not limited, and may be specifically set according to an actual situation. Illustratively, the target generation number of unique identification numbers may be set to 5, 20, 100, etc. It should be noted that, as the target generation number of the unique identification numbers increases, the number of the unique identification numbers applied by the terminal device each time increases, and the pressure of the database in the server decreases continuously.
It should be understood that, in the embodiment of the present application, how to determine the target generation number of the unique identification number is also not limited, and in some embodiments, the target generation number of the unique identification number may be predefined or may be indicated by the server.
For example, if the value of the latest generated unique identification number in the generation record of the unique identification number is N and the target generation number of the unique identification number is k, the terminal device determines that the value range of the unique identification number is N to N + k.
S203, the terminal equipment sends a generation request of the unique identification number to the server, and the generation request contains the value range of the unique identification number.
In this step, after the terminal device determines the value range of the unique identification number, a request for generating the unique identification number may be sent to the server, so as to obtain a plurality of unique identification numbers generated within the value range.
And S204, the server generates a plurality of unique identification numbers in the value range of the unique identification numbers.
In this step, after the server receives the request for generating the unique identification number, a plurality of unique identification numbers can be generated within the value range of the unique identification number.
It should be noted that, in the embodiment of the present application, the number of the generated unique identification numbers is not limited, and for example, if 100 unique identification numbers can be generated within a value range, the server generates 100 unique identification numbers correspondingly.
In some embodiments, after the server generates a plurality of unique identification numbers within the value range of the unique identification number, the generation record of the unique identification number may be updated, so as to generate the value of the newly generated unique identification number.
It should be understood that in the embodiment of the application, the server executes concurrent control of multi-thread synchronization when generating the unique identification number. Wherein, the concurrent control of the multi-thread synchronization can be the concurrent control of synchronization. Through the concurrent control of the multithread synchronization, the server can be kept to generate only the unique identification number corresponding to the generation request sent by the terminal equipment at the same time.
S205, the server sends the plurality of unique identification numbers to the terminal equipment.
In this step, after the server generates the plurality of unique identification numbers within the value range of the unique identification number, the plurality of unique identification numbers can be sent to the terminal device.
In some embodiments, after receiving the plurality of unique identification numbers, the terminal device may store the plurality of unique identification numbers in a local cache. Subsequently, the terminal device may determine the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the usage sequence of the unique identification numbers. The application embodiment does not limit the use sequence of the unique identification number, and the use sequence can be the size sequence of a natural number.
For example, fig. 3 is a schematic diagram of generating a unique identification number according to an embodiment of the present application. As shown in fig. 3, when function 1 of the target application needs to generate a unique identification number, the terminal device may obtain the unique identification number in the range from N to N + k from the database in the server, store the unique identification number in the range from N to N + k in the cache, and return the unique identification number N +1 to function 1. Subsequently, when the function 2 of the target application needs to generate a unique identification number, if the unique identification numbers in the range from N + k to N + k in the local cache are used, the terminal device may obtain the unique identification numbers in the range from N + k to N +2k from the database in the server, store the unique identification numbers in the range from N + k to N +2k in the cache, and return the unique identification number N + k +1 to the function 2.
In the application, by the method for generating the unique identification number, the increased pressure of the database due to generation of the unique identification number can be obviously reduced, and the system performance is improved. Meanwhile, compared with schemes such as machine codes and UUIDs, the readability of the unique identification number can be obviously improved, and the retrieval efficiency of the database is improved.
According to the method for generating the unique identification number, the terminal equipment firstly obtains the generation record of the unique identification number. And secondly, the terminal equipment determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number. And thirdly, the terminal equipment sends a generation request of the unique identification number to the server, and the generation request contains the value range of the unique identification number. And finally, the terminal equipment receives the plurality of unique identification numbers in the value range of the unique identification number sent by the server. By the method, the terminal equipment acquires the plurality of unique identification numbers within the value range of the unique identification number each time, so that the processing pressure of the server in generating the unique identification numbers is reduced, and the influence on the concurrency performance is reduced.
On the basis of the above-described embodiment, how the terminal device acquires the generation record of the unique identification number is described below. Fig. 4 is a signaling interaction diagram of another unique identification number generation method provided in the embodiment of the present application, and as shown in fig. 4, the method includes:
s301, the terminal device sends a reading request of the generation record of the unique identification number to the server.
S302, the server sends the generation record of the unique identification number to the terminal equipment.
And S303, the terminal equipment determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number.
S304, the terminal equipment sends a generation request of the unique identification number to the server, and the generation request contains the value range of the unique identification number.
S305, the server generates a plurality of unique identification numbers in the value range of the unique identification numbers.
S306, the server sends the plurality of unique identification numbers to the terminal equipment.
The technical terms, technical effects, technical features, and alternative embodiments of S301 to S306 can be understood with reference to S201 to S204 shown in fig. 2, and repeated descriptions thereof will not be repeated here.
On the basis of the above embodiment, whether the terminal device directly takes the unique identification number of the local cache will be described below. Fig. 5 is a signaling interaction diagram of a further method for generating a unique identification number according to an embodiment of the present application, as shown in fig. 5, the method includes:
s401, the terminal equipment receives an acquisition request of the unique identification number sent by the target application.
S402, the terminal device determines whether at least one unused unique identification number exists in the local cache.
If so, step S403 is executed, and if not, step S404 is executed.
S403, the terminal device determines the unique identification number to be acquired by the target application from at least one unused unique identification number according to the using sequence of the unique identification numbers.
S404, the terminal device sends a reading request of the generation record of the unique identification number to the server.
S405, the server sends the generation record of the unique identification number to the terminal equipment.
S406, the terminal equipment determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number.
S407, the terminal device sends a generation request of the unique identification number to the server, and the generation request contains a value range of the unique identification number.
And S408, the server generates a plurality of unique identification numbers in the value range of the unique identification numbers.
And S409, the server sends the plurality of unique identification numbers to the terminal equipment.
The technical terms, technical effects, technical features, and alternative embodiments of S401 to S409 can be understood with reference to S201 to S204 shown in fig. 2, and repeated descriptions thereof will not be repeated here.
According to the method for generating the unique identification number, the terminal equipment firstly obtains the generation record of the unique identification number. And secondly, the terminal equipment determines the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number. And thirdly, the terminal equipment sends a generation request of the unique identification number to the server, and the generation request contains the value range of the unique identification number. And finally, the terminal equipment receives the plurality of unique identification numbers in the value range of the unique identification number sent by the server. By the method, the terminal equipment acquires the plurality of unique identification numbers within the value range of the unique identification number each time, so that the processing pressure of the server in generating the unique identification numbers is reduced, and the influence on the concurrency performance is reduced.
Those of ordinary skill in the art will understand that: all or part of the steps for implementing the method embodiments may be implemented by hardware related to program instructions, and the program may be stored in a computer readable storage medium, and when executed, the program performs the steps including the method embodiments; and the aforementioned storage medium includes: various media that can store program codes, such as ROM, RAM, magnetic or optical disks.
Fig. 6 is a schematic structural diagram of a unique identification number generation apparatus according to an embodiment of the present application. The unique identification number generation device may be implemented by software, hardware, or a combination of both, so as to execute the method for generating the unique identification number on the terminal device side. As shown in fig. 6, the unique identification number generation apparatus 500 includes:
a processing module 501, configured to obtain a generation record of a unique identification number; determining the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number;
a sending module 502, configured to send a request for generating a unique identification number to a server, where the request includes a value range of the unique identification number;
the receiving module 503 is configured to receive a plurality of unique identification numbers within the value range of the unique identification number sent by the server.
In an optional implementation manner, the generation record of the unique identification number includes a value of the newly generated unique identification number.
In an optional implementation, the sending module 502 is further configured to send a read request for generating a record of a unique identification number to the server.
The receiving module 503 is further configured to receive a generation record of the unique identification number sent by the server.
In an optional implementation manner, the receiving module 503 is further configured to receive an acquisition request of the unique identification number sent by the target application.
The processing module 501 is further configured to determine whether at least one unused unique identification number exists in the local cache.
The sending module 502 is further configured to send, if not, a read request for generating a record of the unique identification number to the server.
In an optional embodiment, the processing module 501 is further configured to determine, if yes, a unique identification number to be acquired by the target application from at least one unused unique identification number according to a usage sequence of the unique identification numbers.
In an optional implementation manner, the processing module 501 is further configured to store a plurality of unique identification numbers in a local cache; and determining the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the using sequence of the unique identification numbers.
It should be noted that the generating device of the unique identification number provided in the embodiment shown in fig. 6 may be used to execute the method provided by the terminal device side, and the specific implementation manner and the technical effect are similar, and are not described again here.
Fig. 7 is a schematic structural diagram of another unique identification number generation apparatus according to an embodiment of the present application. The unique identification number generation device may be implemented by software, hardware, or a combination of both to execute the above-described server-side unique identification number generation method. As shown in fig. 7, the unique identification number generating apparatus 600 includes:
a receiving module 601, configured to receive a request for generating a unique identification number sent by a terminal device, where the request includes a value range of the unique identification number;
the processing module 602 is configured to generate a plurality of unique identification numbers within a value range of the unique identification numbers.
A sending module 603, configured to send multiple unique identification numbers to the terminal device.
In an optional implementation manner, the receiving module 601 is further configured to receive a read request for generating a record of a unique identification number sent by the terminal device.
The sending module 603 is further configured to send the generated record of the unique identification number to the terminal device.
In an optional implementation manner, the generation record of the unique identification number includes a value of the newly generated unique identification number.
The processing module 602 is further configured to update, in the generation record of the unique identification number, a value of the newly generated unique identification number according to the value range of the unique identification number in the generation request.
In an alternative embodiment, the apparatus performs concurrent control of multi-thread synchronization upon generation of the unique identification number.
It should be noted that the generating device of the unique identification number provided in the embodiment shown in fig. 7 may be used to execute the method provided by the server side, and the specific implementation manner and the technical effect are similar, and are not described herein again.
Fig. 8 is a schematic structural diagram of an electronic device according to an embodiment of the present application. As shown in fig. 8, the electronic device may include: at least one processor 701 and a memory 702. Fig. 8 shows an electronic device, which may be the terminal device or the server, by way of example of a processor.
And a memory 702 for storing programs. In particular, the program may include program code including computer operating instructions.
The memory 702 may comprise high-speed RAM memory, and may also include non-volatile memory (non-volatile memory), such as at least one disk memory.
The processor 701 is configured to execute a computer-executable instruction stored in the memory 702 to implement the method for generating the unique identification number on the terminal device side or the method for generating the unique identification number on the server side.
The processor 701 may be a Central Processing Unit (CPU), an Application Specific Integrated Circuit (ASIC), or one or more Integrated circuits configured to implement the embodiments of the present Application.
Optionally, in a specific implementation, if the communication interface, the memory 702 and the processor 701 are implemented independently, the communication interface, the memory 702 and the processor 701 may be connected to each other through a bus and perform communication with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component Interconnect (PCI) bus, an Extended ISA (EISA) bus, or the like. Buses may be classified as address buses, data buses, control buses, etc., but do not represent only one bus or type of bus.
Alternatively, in a specific implementation, if the communication interface, the memory 702 and the processor 701 are integrated into a chip, the communication interface, the memory 702 and the processor 701 may complete communication through an internal interface.
The embodiment of the application also provides a chip which comprises a processor and an interface. Wherein the interface is used for inputting and outputting data or instructions processed by the processor. The processor is configured to perform the methods provided in the above method embodiments. The chip can be applied to terminal equipment or a server.
The present application also provides a computer-readable storage medium, which may include: various media capable of storing program codes, such as a usb disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, are specifically, the computer-readable storage medium stores program information, and the program information is used for the method for generating the unique identification number.
The embodiment of the present application further provides a program, which is used to execute the method for generating the unique identification number provided in the above method embodiment when the program is executed by a processor.
Embodiments of the present application further provide a program product, such as a computer-readable storage medium, where instructions are stored in the program product, and when the program product runs on a computer, the program product causes the computer to execute the method for generating a unique identification number provided in the above method embodiments.
In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. The procedures or functions according to the embodiments of the invention are brought about in whole or in part when the computer program instructions are loaded and executed on a computer. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored in a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, wireless, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that incorporates one or more of the available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., Solid State Disk (SSD)), among others.
Finally, it should be noted that: the above embodiments are only used to illustrate the technical solution of the present invention, and not to limit the same; while the invention has been described in detail and with reference to the foregoing embodiments, it will be understood by those skilled in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some or all of the technical features may be equivalently replaced; and the modifications or the substitutions do not make the essence of the corresponding technical solutions depart from the scope of the technical solutions of the embodiments of the present invention.

Claims (24)

1. A method for generating a unique identification number is applied to a terminal device, and comprises the following steps:
acquiring a generation record of the unique identification number;
determining the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number;
sending a generation request of the unique identification number to a server, wherein the generation request comprises a value range of the unique identification number;
and receiving a plurality of unique identification numbers in the value range of the unique identification numbers sent by the server.
2. The method according to claim 1, wherein the generation record of the unique identification number contains a value of a newly generated unique identification number.
3. The method according to claim 1 or 2, wherein the obtaining of the generated record of the unique identification number comprises:
sending a reading request of the generated record of the unique identification number to the server;
and receiving the generation record of the unique identification number sent by the server.
4. The method of claim 3, wherein prior to said obtaining the generated record of unique identification numbers, the method further comprises:
receiving an acquisition request of the unique identification number sent by a target application;
determining whether at least one unused unique identification number exists in a local cache;
and if not, sending a reading request of the generated record of the unique identification number to the server.
5. The method of claim 4, wherein after said determining whether at least one unused unique identification number exists in the local cache, the method further comprises:
and if so, determining the unique identification number to be acquired by the target application from the at least one unused unique identification number according to the using sequence of the unique identification number.
6. The method of claim 4, wherein after receiving the plurality of unique identification numbers within the range of values of the unique identification number sent by the server, the method further comprises:
storing the plurality of unique identification numbers in a local cache;
and determining the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the using sequence of the unique identification numbers.
7. A method for generating a unique identification number is applied to a server, and comprises the following steps:
receiving a generation request of a unique identification number sent by a terminal device, wherein the generation request comprises a value range of the unique identification number;
generating a plurality of unique identification numbers in the value range of the unique identification numbers;
and sending the plurality of unique identification numbers to the terminal equipment.
8. The method according to claim 7, wherein before the receiving the request for generating the unique identification number sent by the terminal device, the method further comprises:
receiving a reading request of the generating record of the unique identification number sent by the terminal equipment;
and sending the generated record of the unique identification number to the terminal equipment.
9. The method according to claim 8, wherein the generation record of the unique identification number contains a value of a newly generated unique identification number;
after the sending the plurality of unique identification numbers to the terminal device, the method further comprises:
and updating the value of the newly generated unique identification number in the generation record of the unique identification number according to the value range of the unique identification number in the generation request.
10. The method of any of claims 7-9, wherein the server performs concurrent control of multi-thread synchronization when generating the unique identification number.
11. An apparatus for generating a unique identification number, the apparatus comprising:
the processing module is used for acquiring the generation record of the unique identification number; determining the value range of the unique identification number according to the generation record of the unique identification number and the target generation number of the unique identification number;
the sending module is used for sending a generation request of the unique identification number to a server, wherein the generation request comprises a value range of the unique identification number;
and the receiving module is used for receiving the plurality of unique identification numbers in the value range of the unique identification numbers sent by the server.
12. The apparatus according to claim 11, wherein the generation record of the unique identification number includes a value of a newly generated unique identification number.
13. The apparatus according to claim 11 or 12, wherein the sending module is further configured to send a read request for generating a record of the unique identification number to the server;
the receiving module is further configured to receive a generation record of the unique identification number sent by the server.
14. The apparatus according to claim 13, wherein the receiving module is further configured to receive an acquisition request of the unique identification number sent by a target application;
the processing module is further configured to determine whether at least one unused unique identification number exists in the local cache;
and the sending module is further used for sending a reading request of the record generation of the unique identification number to the server if the unique identification number is not the unique identification number.
15. The apparatus according to claim 14, wherein the processing module is further configured to determine, if yes, a unique identification number to be acquired by the target application from the at least one unused unique identification number according to a usage sequence of the unique identification numbers.
16. The apparatus of claim 14, wherein the processing module is further configured to store the plurality of unique identification numbers in a local cache; and determining the unique identification number to be acquired by the target application from the plurality of unique identification numbers according to the using sequence of the unique identification numbers.
17. An apparatus for generating a unique identification number, the apparatus comprising:
the receiving module is used for receiving a generation request of a unique identification number sent by terminal equipment, wherein the generation request comprises a value range of the unique identification number;
the processing module is used for generating a plurality of unique identification numbers in the value range of the unique identification numbers;
and the sending module is used for sending the plurality of unique identification numbers to the terminal equipment.
18. The apparatus according to claim 17, wherein the receiving module is further configured to receive a read request for generating a record of the unique identification number sent by the terminal device;
the sending module is further configured to send the generation record of the unique identification number to the terminal device.
19. The apparatus according to claim 18, wherein the generation record of the unique identification number includes a value of a newly generated unique identification number;
and the processing module is further configured to update the value of the newly generated unique identification number in the generation record of the unique identification number according to the value range of the unique identification number in the generation request.
20. The apparatus of any of claims 17-19, wherein the apparatus performs concurrent control of multithread synchronization when generating the unique identification number.
21. A terminal device, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method according to any of claims 1-6.
22. A server, comprising: a processor and a memory; wherein the memory stores a computer program adapted to be loaded by the processor and to perform the method according to any of claims 7-10.
23. A computer program product comprising a computer program, characterized in that the computer program realizes the method of any of claims 1-10 when executed by a processor.
24. A computer storage medium, characterized in that it stores a plurality of instructions adapted to be loaded by a processor and to perform the method steps according to any of claims 1-10.
CN202111553139.5A 2021-12-17 2021-12-17 Method and device for generating unique identification number Pending CN114218281A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202111553139.5A CN114218281A (en) 2021-12-17 2021-12-17 Method and device for generating unique identification number

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202111553139.5A CN114218281A (en) 2021-12-17 2021-12-17 Method and device for generating unique identification number

Publications (1)

Publication Number Publication Date
CN114218281A true CN114218281A (en) 2022-03-22

Family

ID=80703718

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202111553139.5A Pending CN114218281A (en) 2021-12-17 2021-12-17 Method and device for generating unique identification number

Country Status (1)

Country Link
CN (1) CN114218281A (en)

Similar Documents

Publication Publication Date Title
CN109284205B (en) Snapshot backup method and device, computer equipment and storage medium
CN112130748A (en) Data access method, network card and server
CN112929401A (en) Registration method and device
CN111064786B (en) Account identifier management method and device
CN113032105A (en) Kubernetes cluster access control method, system and related equipment
CN109697019B (en) Data writing method and system based on FAT file system
CN111803917A (en) Resource processing method and device
CN109150927B (en) File issuing method and device for file storage system
CN110798358B (en) Distributed service identification method and device, computer readable medium and electronic equipment
CN115002011B (en) Flow bidirectional test method and device, electronic equipment and storage medium
CN108647139B (en) System test method, device, storage medium and electronic device
CN103902230A (en) Data processing method, device and system
CN114218281A (en) Method and device for generating unique identification number
JP6233846B2 (en) Variable-length nonce generation
CN115562871A (en) Memory allocation management method and device
CN113076175B (en) Memory sharing method and device for virtual machine
CN115170152A (en) Data distribution method, device, equipment and storage medium
CN114168074A (en) Mirror image storage method, device, storage medium and electronic equipment
CN110753082B (en) Service calling method and terminal equipment
CN111190858B (en) Method, device, equipment and storage medium for storing software information
CN104407846B (en) Information processing method and device
CN113536168A (en) Component processing method and device
CN108959405B (en) Strong consistency reading method of data and terminal equipment
CN113342270A (en) Volume unloading method and device and electronic equipment
CN107291628B (en) Method and apparatus for accessing data storage device

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