Detailed Description
Embodiments of the present disclosure will be described in more detail below with reference to the accompanying drawings. While certain embodiments of the present disclosure are shown in the drawings, it is to be understood that the present disclosure may be embodied in various forms and should not be construed as limited to the embodiments set forth herein, but rather are provided for a more thorough and complete understanding of the present disclosure. It should be understood that the drawings and embodiments of the disclosure are for illustration purposes only and are not intended to limit the scope of the disclosure.
It should be understood that the various steps recited in the method embodiments of the present disclosure may be performed in a different order, and/or performed in parallel. Moreover, method embodiments may include additional steps and/or omit performing the illustrated steps. The scope of the present disclosure is not limited in this respect.
The term "include" and variations thereof as used herein are open-ended, i.e., "including but not limited to". The term "based on" is "based, at least in part, on". The term "one embodiment" means "at least one embodiment"; the term "another embodiment" means "at least one additional embodiment"; the term "some embodiments" means "at least some embodiments". Relevant definitions for other terms will be given in the following description.
It should be noted that the terms "first", "second", and the like in the present disclosure are only used for distinguishing the devices, modules or units, and are not used for limiting the devices, modules or units to be different devices, modules or units, and also for limiting the sequence or interdependence relationship of the functions executed by the devices, modules or units.
It is noted that references to "a", "an", and "the" modifications in this disclosure are intended to be illustrative rather than limiting, and that those skilled in the art will recognize that "one or more" may be used unless the context clearly dictates otherwise.
The names of messages or information exchanged between devices in the embodiments of the present disclosure are for illustrative purposes only, and are not intended to limit the scope of the messages or information.
To make the objects, technical solutions and advantages of the present disclosure more apparent, embodiments of the present disclosure will be described in detail with reference to the accompanying drawings.
The account processing method, device, electronic equipment and computer-readable storage medium provided by the disclosure aim to solve the above technical problems in the prior art.
The following describes the technical solutions of the present disclosure and how to solve the above technical problems in specific embodiments. 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. Embodiments of the present disclosure will be described below with reference to the accompanying drawings.
An embodiment of the present disclosure provides an account processing method, and as shown in fig. 1, the method includes:
step S101: when the account information in the pre-cached second account list meets the first preset condition, detecting whether the account information in the pre-cached second account list meets the second preset condition;
step S102: deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list;
the method comprises the steps that account information which is free or to be distributed is recorded in a first account list; and the second account list records occupied or unallocated account information.
It should be noted that the existing account numbers are generally stored in a relational database, such as Mysql, Oracle, and the like, and when a plurality of users take accounts at the same time, a large number of simultaneous requests may cause the load of the server to be too high, and the processing delay to be increased. Therefore, in the embodiment of the present disclosure, a set of in-memory databases, such as Redis, MongoDb, and the like, may be deployed in front of the service where the relational database is located. Specifically, a first account list is preset in the memory database, the first account list may record idle or account information to be allocated, and the second account list may record occupied or account information that is not allocatable.
For example, when a user needs an account, an account may be randomly selected from the first account list and returned to the user, and then account information of the account is deleted from the first account list and added to the second account list, indicating that the account is occupied or not assignable again.
In order to deal with a large number of account requests, a sufficient number of accounts available for allocation are generally reserved in an account pool, and the account processing can be used for achieving the purpose. The method includes the steps that a first preset condition can be an account number processing starting condition, specifically, when the account number processing starting condition is detected to be met, whether account number information in a pre-cached second account number list meets a second preset condition is detected, wherein the second preset condition can be a preset recovery condition, when an account number meeting the preset recovery condition exists in the second account number list, the account number information of the account number meeting the preset recovery condition in the second account number list is deleted, then the account number information of the account number meeting the preset recovery condition is added to the first account number list, and the account number is idle or can be redistributed.
According to the technical scheme, the first account list and the second account list are preset, and the account information of the user is recorded in the account lists, when the condition that the first preset condition is met is detected, and the account information in the second account list meets the second preset condition, the account information meeting the second preset condition is deleted from the second account list and is added to the first account list. When a large number of accounts need to be allocated, the accounts can be directly taken from the first account list, so that the operation time of a user for requesting account allocation is shortened, meanwhile, account information which is not occupied can be guaranteed to be recovered in a short time, account resource cost is saved, and account resource utilization rate is improved.
The embodiment of the present disclosure provides a possible implementation manner, where the first preset condition may be an account processing start condition, and includes:
and responding to the received account allocation request, and performing account allocation from the first account list.
Specifically, when an account allocation request of a user is received, an account is randomly selected from a first account list and returned to the user, account information of the account is deleted from the first account list, and the account information of the account is added to a second account list. And then detecting whether any account in the second account list meets a second preset condition, wherein the second preset condition can be a preset recovery condition, and deleting the account meeting the preset recovery condition from the second account list and adding the account meeting the preset recovery condition to the first account list to execute account processing. Optionally, in order to ensure the stability of the account pool, while one account is allocated from the first account list, an account meeting a preset recovery condition may be detected from the second account list and added to the first account list.
Optionally, the preset recovery condition includes that any account in the second account list is unoccupied within a fourth preset time, and account information of the account is not used within the fourth preset time.
Specifically, when the account processing starting condition is met, the accounts in the second account list are detected, and if a certain account in the second account list is not used for a long time and information related to the account is not used within a predetermined time after the account processing starting condition is met, for example, within 1 hour, the account is considered to meet a preset recycling condition.
If the account is not processed, network resources are occupied, allocable accounts in the first account list are reduced, and waiting time of a user when the user requests account allocation is increased.
The embodiment of the disclosure provides a smooth and efficient account recovery mechanism by performing account processing when allocating accounts to users, so that the recovery work is smooth to the period of allocating tasks each time, and the stability of an account pool is ensured.
The embodiment of the present disclosure provides a possible implementation manner, where the first preset condition may be an account processing start condition, and includes:
the account allocation request is not received within the first preset time.
It can be understood that if an account allocation request is not received within a period of time, indicating that the taking pressure of the accounts in the account pool is low at the moment, the account batch recycling work can be started. Specifically, when it is detected that there is no account allocation request within a first preset time, for example, within five minutes, the account batch recycling mechanism may be started.
Optionally, it may be detected in the second account list one by one whether an account meets a preset recovery condition, specifically, when the account processing start condition is met, the account in the second account list is detected, and if a certain account in the second account list is not used for a long time and a predetermined time after the account processing start condition is met, for example, information related to the account is not used within 1 hour, the account is considered to meet the preset recovery condition. And then deleting the accounts meeting the recovery conditions from the second account list one by one and adding the accounts to the first account list one by one.
According to the account number distribution method and device, the account numbers are recycled in batches when the account number distribution request is not received within the first preset time, so that a plurality of distributable account numbers are added to the account number pool, and the reliability of the account number pool is guaranteed.
The embodiment of the present disclosure provides a possible implementation manner, where the first preset condition may be an account processing start condition, and includes:
the proportion of the number of the accounts in the first account list to the total number of the accounts is lower than a preset proportion threshold.
It can be understood that, because the account information that is free or to be allocated is recorded in the first account list, when the number of accounts in the first account list is not enough to support a large number of account allocation requests, if a user requests allocation of an account, the waiting time of the user when requesting allocation of an account will be increased, and the login experience of the user is reduced.
Assignable accounts may be sought from the second account list at this point. Optionally, the account satisfying the preset recovery condition in the second account list may be used as the account to be allocated,
optionally, when the number of the accounts in the first account list is less than 10% of the total number of the accounts, it is detected one by one whether any account in the second account list meets the preset recovery condition.
Specifically, when the account processing starting condition is met, the accounts in the second account list are detected, and if a certain account in the second account list is not used for a long time and information related to the account is not used within a predetermined time after the account processing starting condition is met, for example, within 1 hour, the account is considered to meet a preset recycling condition. And then deleting the account information of the accounts meeting the recovery condition from the second account list one by one and adding the account information to the first account list one by one.
According to the embodiment of the invention, the accounts are recycled in batches when the proportion of the number of the accounts in the first account list to the total number of the accounts is lower than the preset proportion threshold value, so that the waiting time of a user when the user requests account allocation is reduced, and the login experience of the user is improved.
In the embodiment of the present disclosure, a possible implementation manner is provided, when account information meeting a second preset condition is deleted from the second account list and added to the first account list,
and if a preset number of account allocation requests are received within second preset time, stopping executing the step of deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list.
It can be understood that, when the number of account allocation requests in a certain period of time reaches a predetermined number, for example, more than 5 account allocation requests are received in each minute, in order to ensure high performance of the taking service, the step of deleting the account information meeting the preset recovery condition from the second account list and adding the account information to the first account list is stopped.
Optionally, after the account information of the account satisfying the preset recovery condition is stopped to be deleted from the second account list and added to the first account list, the account may be continuously selected from the first account list according to the received allocation request and returned to the user, and then the account information of the account is deleted from the first account list and added to the second account list.
The embodiment of the disclosure provides a possible implementation manner, and when detecting that a ratio of the number of accounts in the first account list occurring for a predetermined number of times within a third preset time to the total number of accounts is lower than a preset ratio threshold, generating and sending alarm information.
It will be appreciated that when the number of accounts in the first list of accounts is always low, clearly insufficient to handle the current service stress, an alert message may be generated and sent to the administrator for subsequent servicing.
Optionally, for example, if the number of accounts in the first account list is less than 10% of the total number of accounts within 2 times of 30 minutes, it may be considered that the number of accounts available in the account pool is too small to cope with the current service pressure, and a telephone alarm may be automatically sent to the administrator for subsequent maintenance. Warm prompt information such as patience waiting can be displayed on the terminal, and login anxiety of the user is relieved.
The embodiment of the present disclosure provides a possible implementation manner, and the account processing method further includes: and acquiring account information of the newly added account, and adding the account information of the newly added account into the first account list.
It can be understood that, when a user registers an account on the platform, the database of the platform acquires and stores account information of a new account, such as account ID, account password, nickname, mailbox address, mobile phone number, and the like. And then adding the account information of the newly added account into the first account list so as to be distributed in time when an account distribution request is received, thereby reducing the waiting time of the user and improving the login experience of the user.
An embodiment of the present disclosure provides an account processing apparatus, as shown in fig. 2, the account processing apparatus 20 may include: a detection module 201 and a processing module 202, wherein,
the detection module 201 is configured to detect whether account information in a pre-cached second account list meets a second preset condition when it is detected that the first preset condition is met;
the processing module 202 is configured to delete the account information meeting the second preset condition from the second account list and add the account information to the first account list;
the method comprises the steps that account information which is free or to be distributed is recorded in a first account list; and the second account list records occupied or unallocated account information.
It should be noted that the existing account numbers are generally stored in a relational database, such as Mysql, Oracle, and the like, and when a plurality of users take accounts at the same time, a large number of simultaneous requests may cause the load of the server to be too high, and the processing delay to be increased. Therefore, in the embodiment of the present disclosure, a set of in-memory databases, such as Redis, MongoDb, and the like, may be deployed in front of the service where the relational database is located. Specifically, a first account list is preset in the memory database, the first account list may record idle or account information to be allocated, and the second account list may record occupied or account information that is not allocatable.
For example, when a user needs an account, an account may be randomly selected from the first account list and returned to the user, and then account information of the account is deleted from the first account list and added to the second account list, indicating that the account is occupied or not assignable again.
In order to deal with a large number of account requests, a sufficient number of accounts available for allocation are generally reserved in an account pool, and the account processing can be used for achieving the purpose. The method includes the steps that a first preset condition can be an account number processing starting condition, specifically, when the account number processing starting condition is detected to be met, whether account number information in a pre-cached second account number list meets a second preset condition is detected, wherein the second preset condition can be a preset recovery condition, when an account number meeting the preset recovery condition exists in the second account number list, the account number information of the account number meeting the preset recovery condition in the second account number list is deleted, then the account number information of the account number meeting the preset recovery condition is added to the first account number list, and the account number is idle or can be redistributed.
According to the technical scheme, the first account list and the second account list are preset, and the account information of the user is recorded in the account lists, when the condition that the first preset condition is met is detected, and the account information in the second account list meets the second preset condition, the account information meeting the second preset condition is deleted from the second account list and is added to the first account list. When a large number of accounts need to be allocated, the accounts can be directly taken from the first account list, so that the operation time of a user for requesting account allocation is shortened, meanwhile, account information which is not occupied can be guaranteed to be recovered in a short time, account resource cost is saved, and account resource utilization rate is improved.
In the embodiment of the present disclosure, a possible implementation manner is provided, when account information meeting a second preset condition is deleted from the second account list and added to the first account list,
and if a preset number of account allocation requests are received within second preset time, stopping executing the step of deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list.
It can be understood that, when the number of account allocation requests in a certain period of time reaches a predetermined number, for example, more than 5 account allocation requests are received in every minute, in order to ensure high performance of the taking service, the step of deleting the account information of the account satisfying the preset recovery condition from the second account list and adding the account information to the first account list is stopped.
Optionally, after the account information of the account satisfying the preset recovery condition is stopped to be deleted from the second account list and added to the first account list, the account may be continuously selected from the first account list according to the received allocation request and returned to the user, and then the account information of the account is deleted from the first account list and added to the second account list.
Referring now to FIG. 3, a block diagram of an electronic device 300 suitable for use in implementing embodiments of the present disclosure is shown. The electronic devices in the embodiments of the present disclosure may include, but are not limited to, mobile terminals such as mobile phones, notebook computers, digital broadcast receivers, PDAs (personal digital assistants), PADs (tablet computers), PMPs (portable multimedia players), in-vehicle terminals (e.g., car navigation terminals), and the like, and fixed terminals such as digital TVs, desktop computers, and the like. The electronic device shown in fig. 3 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present disclosure.
The electronic device includes: a memory and a processor, wherein the processor may be referred to as a processing device 301 described below, and the memory may include at least one of a Read Only Memory (ROM)302, a Random Access Memory (RAM)303, and a storage device 308, which are described below:
as shown in fig. 3, the electronic device 300 may include a processing means (e.g., a central processing unit, a graphics processor, etc.) 301 that may perform various appropriate actions and processes in accordance with a program stored in a Read Only Memory (ROM)302 or a program loaded from a storage means 308 into a Random Access Memory (RAM) 303. In the RAM 303, various programs and data necessary for the operation of the electronic apparatus 300 are also stored. The processing device 301, the ROM 302, and the RAM 303 are connected to each other via a bus 304. An input/output (I/O) interface 305 is also connected to bus 304.
Generally, the following devices may be connected to the I/O interface 305: input devices 306 including, for example, a touch screen, touch pad, keyboard, mouse, camera, microphone, accelerometer, gyroscope, etc.; an output device 307 including, for example, a Liquid Crystal Display (LCD), a speaker, a vibrator, and the like; storage devices 308 including, for example, magnetic tape, hard disk, etc.; and a communication device 309. The communication means 309 may allow the electronic device 300 to communicate wirelessly or by wire with other devices to exchange data. While fig. 3 illustrates an electronic device 300 having various means, it is to be understood that not all illustrated means are required to be implemented or provided. More or fewer devices may alternatively be implemented or provided.
In particular, according to an embodiment of the present disclosure, the processes described above with reference to the flowcharts may be implemented as computer software programs. For example, embodiments of the present disclosure include a computer program product comprising a computer program carried on a non-transitory computer readable medium, the computer program containing program code for performing the method illustrated by the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication means 309, or installed from the storage means 308, or installed from the ROM 302. The computer program, when executed by the processing device 301, performs the above-described functions defined in the methods of the embodiments of the present disclosure.
It should be noted that the computer readable medium in the present disclosure can be a computer readable signal medium or a computer readable storage medium or any combination of the two. A computer readable storage medium may be, for example, but not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any combination of the foregoing. More specific examples of the computer readable storage medium may include, but are not limited to: an electrical connection having one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing. In the present disclosure, a computer readable storage medium may be any tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. In contrast, in the present disclosure, a computer readable signal medium may comprise a propagated data signal with computer readable program code embodied therein, either in baseband or as part of a carrier wave. Such a propagated data signal may take many forms, including, but not limited to, electro-magnetic, optical, or any suitable combination thereof. A computer readable signal medium may also be any computer readable medium that is not a computer readable storage medium and that can communicate, propagate, or transport a program for use by or in connection with an instruction execution system, apparatus, or device. Program code embodied on a computer readable medium may be transmitted using any appropriate medium, including but not limited to: electrical wires, optical cables, RF (radio frequency), etc., or any suitable combination of the foregoing.
In some embodiments, the clients, servers may communicate using any currently known or future developed network protocol, such as HTTP (HyperText transfer protocol), and may be interconnected with any form or medium of digital data communication (e.g., a communications network). Examples of communication networks include a local area network ("LAN"), a wide area network ("WAN"), the Internet (e.g., the Internet), and peer-to-peer networks (e.g., ad hoc peer-to-peer networks), as well as any currently known or future developed network.
The computer readable medium may be embodied in the electronic device; or may exist separately without being assembled into the electronic device.
The computer readable medium carries one or more programs which, when executed by the electronic device, cause the electronic device to:
when the account information in the pre-cached second account list meets the first preset condition, detecting whether the account information in the pre-cached second account list meets the second preset condition;
deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list;
the method comprises the steps that account information which is free or to be distributed is recorded in a first account list; and the second account list records occupied or unallocated account information.
Computer program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including but not limited to an object oriented programming language such as Java, Smalltalk, C + +, and conventional procedural programming languages, such as the "C" programming language or similar programming languages. The program code may execute entirely on the user's computer, partly on the user's computer, as a stand-alone software package, partly on the user's computer and partly on a remote computer or entirely on the remote computer or server. In the case of a remote computer, the remote computer may be connected to the user's computer through any type of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or the connection may be made to an external computer (for example, through the Internet using an Internet service provider).
The flowchart and block diagrams in the figures illustrate the architecture, functionality, and operation of possible implementations of systems, methods and computer program products according to various embodiments of the present disclosure. In this regard, each block in the flowchart or block diagrams may represent a module, segment, or portion of code, which comprises one or more executable instructions for implementing the specified logical function(s). It should also be noted that, in some alternative implementations, the functions noted in the block may occur out of the order noted in the figures. For example, two blocks shown in succession may, in fact, be executed substantially concurrently, or the blocks may sometimes be executed in the reverse order, depending upon the functionality involved. It will also be noted that each block of the block diagrams and/or flowchart illustration, and combinations of blocks in the block diagrams and/or flowchart illustration, can be implemented by special purpose hardware-based systems which perform the specified functions or acts, or combinations of special purpose hardware and computer instructions.
The modules or units described in the embodiments of the present disclosure may be implemented by software or hardware. Wherein the designation of a module or unit does not in some cases constitute a limitation of the unit itself.
The functions described herein above may be performed, at least in part, by one or more hardware logic components. For example, without limitation, exemplary types of hardware logic components that may be used include: field Programmable Gate Arrays (FPGAs), Application Specific Integrated Circuits (ASICs), Application Specific Standard Products (ASSPs), systems on a chip (SOCs), Complex Programmable Logic Devices (CPLDs), and the like.
In the context of this disclosure, a machine-readable medium may be a tangible medium that can contain, or store a program for use by or in connection with an instruction execution system, apparatus, or device. The machine-readable medium may be a machine-readable signal medium or a machine-readable storage medium. A machine-readable medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
According to one or more embodiments of the present disclosure, an account processing method is provided, including:
when the account information in the pre-cached second account list meets the first preset condition, detecting whether the account information in the pre-cached second account list meets the second preset condition;
deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list;
the method comprises the steps that account information which is free or to be distributed is recorded in a first account list; and the second account list records occupied or unallocated account information.
Optionally, the first preset condition includes at least one of:
responding to the received account number distribution request, and distributing account numbers from the first account number list;
an account number allocation request is not received within first preset time;
the proportion of the number of the accounts in the first account list to the total number of the accounts is lower than a preset proportion threshold.
Optionally, when the account information meeting the second preset condition is deleted from the second account list and added to the first account list,
and if a preset number of account allocation requests are received within second preset time, stopping executing the step of deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list.
Optionally, when it is detected that the ratio of the number of accounts in the first account list occurring for the predetermined number of times within the third preset time to the total number of accounts is lower than a preset ratio threshold, generating and sending alarm information.
Optionally, the second preset condition includes:
any account in the second account list is not occupied within a fourth preset time, and the account information of the account is not used within the fourth preset time.
Optionally, account information of the newly added account is obtained, and the account information of the newly added account is added to the first account list.
Optionally, the account information includes any one of the following items:
account ID, account password, nickname, mailbox address.
According to one or more embodiments of the present disclosure, an account processing apparatus is provided, further including:
the detection module is used for detecting whether account information in a pre-cached second account list meets a second preset condition or not when the first preset condition is detected to be met;
the processing module is used for deleting the account information meeting the second preset condition from the second account list and adding the account information to the first account list;
the method comprises the steps that account information which is free or to be distributed is recorded in a first account list; and the second account list records occupied or unallocated account information.
According to one or more embodiments of the present disclosure, there is provided an electronic device including:
one or more processors;
a memory;
one or more application programs, wherein the one or more application programs are stored in the memory and configured to be executed by the one or more processors, the one or more programs configured to: an account processing method according to any of the above embodiments is performed.
According to one or more embodiments of the present disclosure, a computer-readable storage medium is provided for storing computer instructions which, when executed on a computer, cause the computer to perform an account processing method according to any of the above-described embodiments.
The foregoing description is only exemplary of the preferred embodiments of the disclosure and is illustrative of the principles of the technology employed. It will be appreciated by those skilled in the art that the scope of the disclosure herein is not limited to the particular combination of features described above, but also encompasses other embodiments in which any combination of the features described above or their equivalents does not depart from the spirit of the disclosure. For example, the above features and (but not limited to) the features disclosed in this disclosure having similar functions are replaced with each other to form the technical solution.
Further, while operations are depicted in a particular order, this should not be understood as requiring that such operations be performed in the particular order shown or in sequential order. Under certain circumstances, multitasking and parallel processing may be advantageous. Likewise, while several specific implementation details are included in the above discussion, these should not be construed as limitations on the scope of the disclosure. Certain features that are described in the context of separate embodiments can also be implemented in combination in a single embodiment. Conversely, various features that are described in the context of a single embodiment can also be implemented in multiple embodiments separately or in any suitable subcombination.
Although the subject matter has been described in language specific to structural features and/or methodological acts, it is to be understood that the subject matter defined in the appended claims is not necessarily limited to the specific features or acts described above. Rather, the specific features and acts described above are disclosed as example forms of implementing the claims.