[go: up one dir, main page]

CN111338810A - Method and apparatus for storing information - Google Patents

Method and apparatus for storing information Download PDF

Info

Publication number
CN111338810A
CN111338810A CN201811553616.6A CN201811553616A CN111338810A CN 111338810 A CN111338810 A CN 111338810A CN 201811553616 A CN201811553616 A CN 201811553616A CN 111338810 A CN111338810 A CN 111338810A
Authority
CN
China
Prior art keywords
queue
identification information
confirmed
stored
determining
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
CN201811553616.6A
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.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201811553616.6A priority Critical patent/CN111338810A/en
Publication of CN111338810A publication Critical patent/CN111338810A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F9/00Arrangements for program control, e.g. control units
    • G06F9/06Arrangements for program control, e.g. control units using stored programs, i.e. using an internal store of processing equipment to receive or retain programs
    • G06F9/46Multiprogramming arrangements
    • G06F9/54Interprogram communication
    • G06F9/546Message passing systems or structures, e.g. queues
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/541Client-server
    • GPHYSICS
    • G06COMPUTING OR CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F2209/00Indexing scheme relating to G06F9/00
    • G06F2209/54Indexing scheme relating to G06F9/54
    • G06F2209/548Queue

Landscapes

  • Engineering & Computer Science (AREA)
  • Software Systems (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Information Transfer Between Computers (AREA)

Abstract

The embodiment of the application discloses a method and a device for storing information. One embodiment of the method comprises: receiving at least one identification information to be stored; selecting identification information to be stored from at least one identification information to be stored, and executing the following storage steps: generating a queue element comprising the identification information to be stored and the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether a queue length of the target queue is less than a length threshold; in response to determining yes, storing the generated queue element to the target queue; in response to the determination of no, establishing a new queue, storing the generated queue elements to the new queue, adding the new queue to the queue group, and determining the new queue as a target queue; determining whether at least one piece of identification information to be stored has unselected identification information to be stored; in response to determining that there is no, outputting the set of queues. This embodiment enables deduplication of the queue.

Description

Method and apparatus for storing information
Technical Field
The embodiment of the application relates to the technical field of computers, in particular to the technical field of internet, and particularly relates to a method and a device for storing information.
Background
A message is a unit of data that is transferred between two computers. The message may contain a text string; embedded objects may also be included.
A message queue is a container that holds messages during their transmission. The message queue manager acts as a man-in-the-middle in relaying a message from its source to its destination. The main purpose of the queues is to provide routing and guarantee delivery of messages; if the recipient is not available when the message is sent, the message queue will hold the message until it can be successfully delivered.
Disclosure of Invention
The embodiment of the application provides a method and a device for storing information.
In a first aspect, an embodiment of the present application provides a method for storing information, where the method includes: receiving at least one identification information to be stored; selecting the identification information to be stored from the at least one identification information to be stored, and executing the following storage steps: generating a queue element comprising the selected identification information to be stored and the time information of the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether the queue length of the target queue is smaller than a length threshold value; in response to determining yes, storing the generated queue element to the target queue; in response to the determination result, establishing a new queue, storing the generated queue elements in the new queue, adding the new queue into the queue group, and determining the new queue as a target queue; determining whether the at least one piece of identification information to be stored has unselected identification information to be stored; in response to determining that there is no, outputting the set of queues.
In some embodiments, the above method further comprises: and in response to determining that the unselected identification information to be stored exists in the at least one identification information to be stored, reselecting the unselected identification information to be stored from the at least one identification information to be stored, and continuing to execute the storing step.
In some embodiments, after the outputting the set of queues in response to determining that it does not exist, the storing further comprises: and deleting the same queue elements in the queues except the target queue in the queue group as the queue elements in the target queue.
In some embodiments, after the outputting the set of queues in response to determining that it does not exist, the storing further comprises: sequentially acquiring a preset number of queue elements from the target queue, generating elements to be confirmed based on a preset retry number, identification information in the queue elements and time information for the queue elements in the acquired preset number of queue elements, adding the generated elements to be confirmed to the queue to be confirmed, and deleting the queue elements from the target queue.
In some embodiments, the storing step further comprises: for an element to be confirmed in the queue to be confirmed, sending identification information in the element to be confirmed to a communication connected client, receiving feedback information sent by the client and aiming at the identification information, increasing the retry number in the element to be confirmed by a preset value in response to the fact that the identification information is not confirmed according to the feedback information, determining whether the retry number in the element to be confirmed is larger than a retry number threshold value or not in response to the fact that the difference value between the time corresponding to the time information in the element to be confirmed and the current time is smaller than or equal to a preset time length, and storing the element to be confirmed into a dead mail queue in response to the fact that the retry number is larger than the retry number threshold value, and deleting the element to be confirmed from the queue to be confirmed, and in response to determining that the feedback information indicates that the identification information is confirmed, deleting the element to be confirmed from the queue to be confirmed.
In a second aspect, an embodiment of the present application provides an apparatus for storing information, the apparatus including: a receiving unit configured to receive at least one identification information to be stored; a storage unit configured to select identification information to be stored from the at least one identification information to be stored, and execute the following storage steps: generating a queue element comprising the selected identification information to be stored and the time information of the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether the queue length of the target queue is smaller than a length threshold value; in response to determining yes, storing the generated queue element to the target queue; in response to the determination result, establishing a new queue, storing the generated queue elements in the new queue, adding the new queue into the queue group, and determining the new queue as a target queue; determining whether the at least one piece of identification information to be stored has unselected identification information to be stored; in response to determining that there is no, outputting the set of queues.
In some embodiments, the above apparatus further comprises: and a continuing unit configured to, in response to determining that the at least one piece of identification information to be stored does not include the identification information to be stored that has not been selected, reselect the identification information to be stored that has not been selected from the at least one piece of identification information to be stored, and continue to perform the storing step.
In some embodiments, the memory unit further includes: a first deleting unit configured to delete an element in the queue other than the target queue in the queue group, the element being the same as a queue element in the target queue.
In some embodiments, the memory unit further includes: a second deleting unit configured to sequentially acquire a preset number of queue elements from the target queue, generate an element to be confirmed based on a preset retry number, identification information in the queue element, and time information for the queue elements among the acquired preset number of queue elements, add the generated element to be confirmed to the queue to be confirmed, and delete the queue element from the target queue.
In some embodiments, the memory unit further includes: a third deletion unit configured to transmit identification information in an element to be confirmed in the queue to be confirmed to a communicatively connected client, receive feedback information for the identification information transmitted from the client, increase a number of retries in the element to be confirmed by a predetermined value in response to determining that the identification information is not confirmed based on the feedback information, determine whether the number of retries in the element to be confirmed is greater than a threshold number of retries in response to determining that a difference between a time corresponding to time information in the element to be confirmed and a current time is less than or equal to a preset time period, store the element to be confirmed in a dead mail queue in response to determining that the number of retries is greater than the threshold number of retries, and delete the element to be confirmed from the queue to be confirmed in response to determining that the feedback information indicates that the identification information is confirmed, and deleting the element to be confirmed from the queue to be confirmed.
In a third aspect, an embodiment of the present application provides a server, including: one or more processors; a storage device having one or more programs stored thereon which, when executed by one or more processors, cause the one or more processors to implement a method as in any embodiment of a method for storing information.
In a fourth aspect, embodiments of the present application provide a computer-readable medium on which a computer program is stored, which when executed by a processor, implements a method as in any one of the embodiments of the method for storing information.
The method and the device for storing information provided by the embodiment of the application firstly receive at least one piece of identification information to be stored. Then, selecting the identification information to be stored from the at least one identification information to be stored, and executing the following storage steps: in response to determining that the target queue in the queue group does not include the selected identification information to be stored, generating a queue element including the selected identification information to be stored and the time information of the current time, and determining whether the queue length of the target queue is smaller than a length threshold; in response to determining yes, storing the generated queue element to the target queue; in response to the determination result, establishing a new queue, storing the generated queue elements in the new queue, adding the new queue into the queue group, and determining the new queue as a target queue; determining whether the at least one piece of identification information to be stored has unselected identification information to be stored; in response to determining that there is no, outputting the set of queues. According to the method and the device, the identification information to be stored, which is not included in the target queue in the queue group, is stored in the target queue or the new queue, and the new queue is added to the queue group, so that the queue elements in the queue do not have the same identification information, the de-duplication effect in the queue can be realized, and the storage space is saved.
Drawings
Other features, objects and advantages of the present application will become more apparent upon reading of the following detailed description of non-limiting embodiments thereof, made with reference to the accompanying drawings in which:
FIG. 1 is an exemplary system architecture diagram in which one embodiment of the present application may be applied;
FIG. 2 is a flow diagram of one embodiment of a method for storing information according to the present application;
FIG. 3 is a schematic diagram of an application scenario of a method for storing information according to an embodiment of the present application;
FIG. 4 is a flow diagram of yet another embodiment of a method for storing information according to the present application;
FIG. 5 is a schematic block diagram of one embodiment of an apparatus for storing information in accordance with the present application;
FIG. 6 is a schematic block diagram of a computer system suitable for use in implementing a server according to embodiments of the present application.
Detailed Description
The present application will be described in further detail with reference to the following drawings and examples. It is to be understood that the specific embodiments described herein are merely illustrative of the relevant invention and not restrictive of the invention. It should be noted that, for convenience of description, only the portions related to the related invention are shown in the drawings.
It should be noted that the embodiments and features of the embodiments in the present application may be combined with each other without conflict. The present application will be described in detail below with reference to the embodiments with reference to the attached drawings.
Fig. 1 illustrates an exemplary system architecture 100 to which the method for storing information or the apparatus for storing information of the embodiments of the present application may be applied.
As shown in fig. 1, the system architecture 100 may include terminal devices 101, 102, 103, a network 104, and a server 105. The network 104 serves as a medium for providing communication links between the terminal devices 101, 102, 103 and the server 105. Network 104 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
The terminal devices 101, 102, 103 interact with a server 105 via a network 104 to receive or send messages or the like. Various applications may be installed on the terminal devices 101, 102, 103, such as shopping applications, search applications, instant messaging tools, mailbox clients, social platform software, text editing applications, browser applications, reading applications, and the like.
The terminal apparatuses 101, 102, and 103 may be hardware or software. When the terminal devices 101, 102, 103 are hardware, they may be various electronic devices including, but not limited to, smart phones, tablet computers, e-book readers, laptop portable computers, desktop computers, and the like. When the terminal apparatuses 101, 102, 103 are software, they can be installed in the electronic apparatuses listed above. It may be implemented as a plurality of software or software modules (for example to provide a shopping-like service) or as a single software or software module. And is not particularly limited herein.
The server 105 may be a server that provides various services, such as an information storage server applied to the terminal apparatuses 101, 102, 103. The information storage server may generate a queue element including the selected identification information to be stored and time information of a current time, and store the generated queue element, and output the queue group, in response to determining that the selected identification information to be stored is not included in a target queue in the queue group.
It should be noted that the method for storing information provided in the embodiment of the present application is generally performed by the server 105, and accordingly, the apparatus for storing information is generally disposed in the server 105.
It should be understood that the number of terminal devices, networks, and servers in fig. 1 is merely illustrative. There may be any number of terminal devices, networks, and servers, as desired for implementation.
With continued reference to FIG. 2, a flow 200 of one embodiment of a method for storing information in accordance with the present application is shown. The method for storing information comprises the following steps:
step 201, at least one identification information to be stored is received.
In this embodiment, the execution subject of the method for storing information (e.g., server 105 shown in fig. 1) may receive the identification information to be stored in a variety of ways. For example, the execution principal may receive the identification information to be stored therein directly from the communicatively connected client (e.g., terminal devices 101, 102, 103 shown in fig. 1). As another example, the execution principal may receive the identification information to be stored therein from a database server (not shown in fig. 1) through a wired connection manner or a wireless connection manner.
In the present embodiment, the identification information may include various symbols for identification, for example, numbers. The identification information to be stored characterizes the various symbols to be stored for recognition.
Step 202, selecting identification information to be stored from at least one piece of identification information to be stored.
In this embodiment, the executing agent may select the identification information to be stored from the at least one piece of identification information to be stored received in step 201, and execute the storing steps from step 203 to step 208. The selection manner of the identification information to be stored is not limited in the present application. For example, the identification information to be stored may be randomly selected, or the identification information to be stored in at least one piece of identification information to be stored may be sorted to select the identification information to be stored in sequence.
Step 203, in response to determining that the target queue in the queue group does not include the selected identification information to be stored, generating a queue element including the selected identification information to be stored and the time information of the current time.
In this embodiment, the queue group is a queue group composed of several queues. A queue is composed of several queue elements. The queue element includes identification information and time information. The target queue may be a specified queue in the queue group, e.g., a newly established current queue. It should be noted that the queue group may be empty, and in this case, a queue is created as the target queue and added to the queue group, and then the content of step 203 is executed.
In this embodiment, that the target queue does not include the selected to-be-stored identification information means that the queue elements in the target queue do not include the selected to-be-stored identification information.
In the present embodiment, the time information of the current time may be various information indicating the time of the current time. As an example, the time information may be time data accurate to nanoseconds.
Step 204, determine whether the queue length of the target queue is less than the length threshold.
In this embodiment, the queue length refers to the number of elements in the queue. The length threshold may be a data value preset by a technician, for example, the length threshold may be 100000.
In response to determining yes, the generated queue element is stored to the target queue, step 205.
In this embodiment, the above-mentioned storing of the generated queue element to the target queue refers to adding the queue element to the target queue.
In response to a determination of no, a new queue is established, the generated queue elements are stored in the new queue, the new queue is added to the queue group, and the new queue is determined to be the target queue, step 206.
In this embodiment, the execution agent adds a queue element to the new queue. The new queue is then added to the queue group. The new queue is then treated as a new target queue.
Step 207, determining whether at least one piece of to-be-stored identification information has unselected to-be-stored identification information.
In this embodiment, if the execution subject determines that there is no unselected identification information to be stored in the at least one identification information to be stored, the execution subject may continue to execute step 208. If the execution main body determines that the unselected identification information to be stored exists in the at least one identification information to be stored, the unselected identification information to be stored can be reselected from the at least one identification information to be stored, and the storage step is continuously executed.
In response to determining that there is no, step 208, the set of queues is output.
In this embodiment, the output mode may be that the execution subject stores the queue group locally, or sends it to the terminal device or the database server.
In some optional implementations of this embodiment, after the outputting the set of queues in response to determining that the queue does not exist, the storing further includes: and deleting the same queue elements in the queues except the target queue in the queue group as the queue elements in the target queue.
Specifically, for a queue element in the target queue, for a queue other than the target queue in the queue group, determining whether the queue has the identification information in the queue element; in response to determining that the identification information is present in the queue, the identification information is deleted from the queue.
By the step of deleting the same elements as the queue elements in the target queue in the queues except the target queue in the queue group, the queue elements in the queue group can be subjected to inter-queue deduplication, and further deduplication can further save storage space.
With further reference to fig. 3, fig. 3 is a schematic diagram of an application scenario of the method for storing information according to the present embodiment.
In the application scenario of fig. 3, a server 302 providing background support for shopping-like applications in a terminal device 301 may run a method for storing information, comprising:
first, the server 302 may receive at least one number information {1001} of the terminal device 301. Thereafter, the server 302 may select 1001 from the at least one number information {1001} and perform the following storing step: the server 302, in response to determining that 1001 is not included in the current queue { (1003, 11:10:20), (1004, 11:10:21), (1005, 11:10:22), (1006, 11:10:23) }3031 in the queue group 303, generates a queue element (1001, 15:10:20) that includes 1001 and the current time 15:10:20, and determines whether the queue length of the above-described current queue 3031 is less than the length threshold 5. The server 302 stores the generated queue element (1001, 15:10:20) to the above-described current queue { (1003, 11:10:20), (1004, 11:10:21), (1005, 11:10:22), (1006, 11:10:23), (1001, 15:10:20) }3031 in response to determining yes. It is determined whether or not there is any number information that has not been selected among the at least one number information {1001 }. In response to determining that there is no queue set, the queue set is stored to database server 304.
In the method for storing information in this embodiment, at least one piece of identification information to be stored is received by the server 302. Then, the server 302 may select the identification information to be stored from the at least one identification information to be stored, and perform the following storing steps: if the server 302 determines that the target queue in the queue group does not include the selected identification information to be stored, generating a queue element including the selected identification information to be stored and the time information of the current time, and determining whether the queue length of the target queue is smaller than a length threshold; then, if the server 302 determines yes, the generated queue element is stored in the target queue; if the server 302 determines no, a new queue is established, the generated queue elements are stored in the new queue, the new queue is added to the queue group, and the new queue is determined as a target queue; if the server 302 determines whether the at least one piece of identification information to be stored does not have the unselected identification information to be stored; if it is determined that the queue group does not exist, the server 302 outputs the queue group. The method for storing the information enriches the information storage mode, can save the storage space by carrying out duplication elimination on the elements in the queue, is beneficial to reducing the repeated processing times when the identification information in the queue is subsequently processed, and is beneficial to improving the efficiency of the subsequent processing process.
With further reference to fig. 4, a flow 400 of yet another embodiment of a method for storing information is shown. The process 400 of the method for storing information includes the steps of:
step 401, at least one identification information to be stored is received.
Step 402, selecting identification information to be stored from at least one piece of identification information to be stored.
Step 403, in response to determining that the selected identification information to be stored is not included in the target queue in the queue group, generating a queue element including the selected identification information to be stored and the time information of the current time.
At step 404, it is determined whether the queue length of the target queue is less than a length threshold.
In response to determining yes, step 405 stores the generated queue element to the target queue.
In response to a determination of no, a new queue is established, the generated queue elements are stored to the new queue, the new queue is added to the group of queues, and the new queue is determined to be the target queue, step 406.
Step 407, determining whether at least one piece of to-be-stored identification information has unselected to-be-stored identification information.
In response to determining that there is no, step 408, outputs the set of queues.
In the present embodiment, the specific operations of steps 401 and 408 are substantially the same as the operations of steps 201 and 208 in the embodiment shown in fig. 2, and are not repeated herein.
Step 409, sequentially acquiring a preset number of queue elements from the target queue, generating to-be-confirmed elements for the queue elements in the acquired preset number of queue elements based on a preset retry number, identification information and time information in the queue elements, adding the generated to-be-confirmed elements to the to-be-confirmed queue, and deleting the queue elements from the target queue.
In this embodiment, the above-mentioned sequential acquisition refers to acquisition in the order of the queue. The preset number can be set according to actual needs, for example, 10. The predetermined retry number may be set according to actual needs, for example, 0. The element to be confirmed comprises three attributes of retry times, identification information and time information. The identification information in the element to be confirmed is used for consumption, and if the identification information in the element to be confirmed is consumed, the execution main body receives the consumption confirmation information and indicates that the element to be confirmed is confirmed. The queue to be confirmed is a queue for storing elements to be confirmed, and the queue to be confirmed may be empty at initialization. The above "consumption" generally refers to the consumption of a queue of messages in a database.
In some optional implementation manners of this embodiment, the storing step may further include: for an element to be confirmed in the queue to be confirmed, sending identification information in the element to be confirmed to a communication connected client, receiving feedback information sent by the client and aiming at the identification information, increasing the retry number in the element to be confirmed by a preset value in response to the fact that the identification information is not confirmed according to the feedback information, determining whether the retry number in the element to be confirmed is larger than a retry number threshold value or not in response to the fact that the difference value between the time corresponding to the time information in the element to be confirmed and the current time is smaller than or equal to a preset time length, and storing the element to be confirmed into a dead mail queue in response to the fact that the retry number is larger than the retry number threshold value, and deleting the element to be confirmed from the queue to be confirmed, and in response to determining that the feedback information indicates that the identification information is confirmed, deleting the element to be confirmed from the queue to be confirmed. The predetermined value may be set according to actual needs, for example, 1. The preset time period can be set according to actual needs, for example, 2 hours. The threshold number of retries may be set according to actual needs, for example, 10. The deadlock queue typically includes a queue for holding messages that fail or expire. The identification information being confirmed generally means that the identification information has been successfully processed by the client. In the field of database technology, the queue to be confirmed may be understood as a queue to be consumed. The above feedback information may be understood as information whether or not it has been consumed.
Optionally, in response to determining that the retry number is less than or equal to the retry number threshold, modifying the time information of the element to be confirmed to the current time, and storing the time information in the next queue to be confirmed. The current time may be various time information indicating the current time. As an example, the time information may be time data accurate to nanoseconds.
As can be seen from fig. 4, compared with the corresponding embodiment of fig. 2, the flow 400 of the method for storing information in the present embodiment highlights the steps of generating an element to be confirmed for a queue element based on a preset number of retries and a target queue, and adding the element to be confirmed to the queue to be confirmed, and then deleting the queue element from the target queue. Therefore, the scheme described in this embodiment may apply the queue element to the queue to be confirmed on the basis of the queue group obtained in the embodiment shown in fig. 2. In the application process, the queue elements which generate the elements to be confirmed are deleted from the target queue, and the queue elements in the target queue are not reused, so that the reliability of the queue to be confirmed is improved.
With further reference to fig. 5, as an implementation of the methods shown in the above-mentioned figures, the present application provides an embodiment of an apparatus for storing information, which corresponds to the method embodiment shown in fig. 2, and which is particularly applicable to various electronic devices.
As shown in fig. 5, the apparatus 500 for storing information described above in this embodiment includes: a receiving unit 501 configured to receive at least one identification information to be stored; a storage unit 502 configured to select identification information to be stored from the at least one identification information to be stored, and perform the following storage steps: generating a queue element comprising the selected identification information to be stored and the time information of the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether the queue length of the target queue is smaller than a length threshold value; in response to determining yes, storing the generated queue element to the target queue; in response to the determination result, establishing a new queue, storing the generated queue elements in the new queue, adding the new queue into the queue group, and determining the new queue as a target queue; determining whether the at least one piece of identification information to be stored has unselected identification information to be stored; in response to determining that there is no, outputting the set of queues.
In some optional implementations of this embodiment, the apparatus further includes: and a continuing unit (not shown in fig. 5) configured to, in response to determining that there is unselected to-be-stored identification information in the at least one to-be-stored identification information, reselect the unselected to-be-stored identification information from the at least one to-be-stored identification information, and continue to perform the storing step.
In some optional implementations of this embodiment, the storage unit further includes: a first deletion unit (not shown in fig. 5) configured to delete the same element as the queue element in the target queue in the queue group other than the target queue.
In some optional implementations of this embodiment, the storage unit further includes: a second deletion unit (not shown in fig. 5) configured to sequentially acquire a preset number of queue elements from the target queue, generate an element to be confirmed based on a preset number of retries, identification information in the queue element, and time information for a queue element of the acquired preset number of queue elements, add the generated element to be confirmed to the queue to be confirmed, and delete the queue element from the target queue.
Optionally, the storage unit further includes: a third deletion unit (not shown in fig. 5) configured to, for an element to be confirmed in the queue to be confirmed, send identification information in the element to be confirmed to a communicatively connected client, receive feedback information for the identification information sent from the client, increase a number of retries in the element to be confirmed by a predetermined value in response to determining that the identification information is not confirmed based on the feedback information, determine whether the number of retries in the element to be confirmed is greater than a threshold number of retries in response to determining that a difference between a time corresponding to time information in the element to be confirmed and a current time is less than or equal to a preset time period, store the element to be confirmed in a deadlock queue in response to determining that the number of retries is greater than the threshold number of retries, and delete the element to be confirmed from the queue to be confirmed, in response to determining that the feedback information indicates that the identification information is confirmed, and deleting the element to be confirmed from the queue to be confirmed.
The above embodiments of the present application provide an apparatus, and the receiving unit 501 is configured to receive at least one identification information to be stored. A storage unit 502 configured to select identification information to be stored from the at least one identification information to be stored, and perform the following storage steps: firstly, in response to the fact that the target queues in the queue group do not include the selected identification information to be stored, generating queue elements including the selected identification information to be stored and the time information of the current time; then, determining whether the queue length of the target queue is smaller than a length threshold value; then, in response to determining yes, storing the generated queue element to the target queue; then, in response to the determination of no, establishing a new queue, storing the generated queue elements in the new queue, adding the new queue to the queue group, and determining the new queue as a target queue; then, determining whether the at least one piece of identification information to be stored has unselected identification information to be stored; finally, in response to determining that there is no, outputting the set of queues. Therefore, the de-duplicated queue group in the queue can be obtained, the de-duplicated modes of the message queue are enriched, the storage space is saved, and the efficiency of the message queue during application is improved.
Referring now to FIG. 6, shown is a block diagram of a computer system 600 suitable for use in implementing a server according to embodiments of the present application. The server shown in fig. 6 is only an example, and should not bring any limitation to the functions and the scope of use of the embodiments of the present application.
As shown in fig. 6, the computer system 600 includes a Central Processing Unit (CPU)601 that can perform various appropriate actions and processes according to a program stored in a Read Only Memory (ROM)602 or a program loaded from a storage section 608 into a Random Access Memory (RAM) 603. In the RAM 603, various programs and data necessary for the operation of the system 600 are also stored. The CPU 601, ROM 602, and RAM 603 are connected to each other via a bus 604. An input/output (I/O) interface 605 is also connected to bus 604.
The following components are connected to the I/O interface 605: an input portion 606 including a keyboard, a mouse, and the like; an output portion 607 including a display such as a Cathode Ray Tube (CRT), a Liquid Crystal Display (LCD), and the like, and a speaker; a storage section 608 including a hard disk and the like; and a communication section 609 including a network interface card such as a LAN card, a modem, or the like. The communication section 609 performs communication processing via a network such as the internet. The driver 610 is also connected to the I/O interface 605 as needed. A removable medium 611 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, or the like is mounted on the drive 610 as necessary, so that a computer program read out therefrom is mounted in the storage section 608 as necessary.
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 embodied on a computer readable medium, the computer program comprising program code for performing the method illustrated in the flow chart. In such an embodiment, the computer program may be downloaded and installed from a network through the communication section 609, and/or installed from the removable medium 611. The computer program performs the above-described functions defined in the method of the present application when executed by a Central Processing Unit (CPU) 601.
It should be noted that the computer readable medium described herein 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 application, 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 this application, however, a computer readable signal medium may include a propagated data signal with computer readable program code embodied therein, for example, 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: wireless, wire, fiber optic cable, RF, etc., or any suitable combination of the foregoing.
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 application. 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 units described in the embodiments of the present application may be implemented by software or hardware. The described units may also be provided in a processor, and may be described as: a processor includes a receiving unit and a storage unit. Where the names of these units do not in some cases constitute a limitation of the unit itself, for example, a receiving unit may also be described as a "unit that receives at least one identification information to be stored".
As another aspect, the present application also provides a computer-readable medium, which may be contained in the server described in the above embodiments; or may exist separately and not be assembled into the server. The computer readable medium carries one or more programs which, when executed by the server, cause the server to: receiving at least one identification information to be stored; selecting the identification information to be stored from the at least one identification information to be stored, and executing the following storage steps: generating a queue element comprising the selected identification information to be stored and the time information of the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether the queue length of the target queue is smaller than a length threshold value; in response to determining yes, storing the generated queue element to the target queue; in response to the determination result, establishing a new queue, storing the generated queue elements in the new queue, adding the new queue into the queue group, and determining the new queue as a target queue; determining whether the at least one piece of identification information to be stored has unselected identification information to be stored; in response to determining that there is no, outputting the set of queues.
The above description is only a preferred embodiment of the application 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 invention herein disclosed is not limited to the particular combination of features described above, but also encompasses other arrangements formed by any combination of the above features or their equivalents without departing from the spirit of the invention. For example, the above features may be replaced with (but not limited to) features having similar functions disclosed in the present application.

Claims (12)

1. A method for storing information, comprising:
receiving at least one identification information to be stored;
selecting identification information to be stored from the at least one identification information to be stored, and executing the following storage steps: generating a queue element comprising the selected identification information to be stored and the time information of the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether a queue length of the target queue is less than a length threshold; in response to determining yes, storing the generated queue element to the target queue; in response to determining no, establishing a new queue, storing the generated queue elements to the new queue, adding the new queue to the group of queues, and determining the new queue as a target queue; determining whether unselected identification information to be stored exists in the at least one identification information to be stored; in response to determining that there is no, outputting the set of queues.
2. The method of claim 1, wherein the method further comprises:
and in response to determining that the unselected identification information to be stored exists in the at least one identification information to be stored, reselecting the unselected identification information to be stored from the at least one identification information to be stored, and continuing to execute the storing step.
3. The method of any of claims 1-2, wherein after the outputting the set of queues in response to determining the absence, the storing step further comprises:
deleting the same queue elements in the queues in the queue group except the target queue as the queue elements in the target queue.
4. The method of any of claims 1-2, wherein after the outputting the set of queues in response to determining the absence, the storing step further comprises:
sequentially acquiring a preset number of queue elements from the target queue, generating elements to be confirmed based on a preset retry number, identification information in the queue elements and time information for the queue elements in the acquired preset number of queue elements, adding the generated elements to be confirmed to the queue to be confirmed, and deleting the queue elements from the target queue.
5. The method of claim 4, wherein the storing step further comprises:
for an element to be confirmed in the queue to be confirmed, sending identification information in the element to be confirmed to a client connected to communication, receiving feedback information sent from the client and aiming at the identification information, increasing a retry number in the element to be confirmed by a preset value in response to determining that the identification information is not confirmed according to the feedback information, determining whether the retry number in the element to be confirmed is larger than a retry number threshold value or not in response to determining that a difference value between a time corresponding to time information in the element to be confirmed and a current time is smaller than or equal to a preset time length, and storing the element to be confirmed into a dead mail queue in response to determining that the retry number is larger than the retry number threshold value, and deleting the element to be confirmed from the queue to be confirmed, and in response to determining that the feedback information represents that the identification information is confirmed, deleting the element to be confirmed from the queue to be confirmed.
6. An apparatus for storing information, comprising:
a receiving unit configured to receive at least one identification information to be stored;
a storage unit configured to select identification information to be stored from the at least one identification information to be stored, and perform the following storing steps: generating a queue element comprising the selected identification information to be stored and the time information of the current time in response to determining that the target queue in the queue group does not comprise the selected identification information to be stored; determining whether a queue length of the target queue is less than a length threshold; in response to determining yes, storing the generated queue element to the target queue; in response to determining no, establishing a new queue, storing the generated queue elements to the new queue, adding the new queue to the group of queues, and determining the new queue as a target queue; determining whether unselected identification information to be stored exists in the at least one identification information to be stored; in response to determining that there is no, outputting the set of queues.
7. The apparatus of claim 6, wherein the apparatus further comprises:
and a continuing unit configured to, in response to determining that the at least one piece of identification information to be stored does not have the identification information to be stored that is not selected, reselect the identification information to be stored that is not selected from the at least one piece of identification information to be stored, and continue to perform the storing step.
8. The apparatus of one of claims 6-7, wherein the storage unit further comprises:
a first deletion unit configured to delete an element in a queue other than the target queue in the queue group that is the same as a queue element in the target queue.
9. The apparatus of one of claims 6-7, wherein the storage unit further comprises:
a second deletion unit configured to sequentially acquire a preset number of queue elements from the target queue, generate an element to be confirmed based on a preset number of retries, identification information in the queue element, and time information for the queue element among the acquired preset number of queue elements, add the generated element to be confirmed to the queue to be confirmed, and delete the queue element from the target queue.
10. The apparatus of claim 9, wherein the storage unit further comprises:
a third deletion unit configured to, for an element to be confirmed in the queue to be confirmed, send identification information in the element to be confirmed to a communicatively connected client, receive feedback information sent from the client for the identification information, increase a number of retries in the element to be confirmed by a predetermined value in response to determining that the identification information is not confirmed according to the feedback information, determine whether the number of retries in the element to be confirmed is greater than a threshold number of retries in response to determining that a difference between a time corresponding to time information in the element to be confirmed and a current time is less than or equal to a preset time period, store the element to be confirmed in a dead mail queue in response to determining that the number of retries is greater than the threshold number of retries, and delete the element to be confirmed from the queue to be confirmed in response to determining that the feedback information indicates that the identification information has been confirmed, and deleting the element to be confirmed from the queue to be confirmed.
11. A server, comprising:
one or more processors;
a storage device having one or more programs stored thereon,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-5.
12. A computer-readable medium, on which a computer program is stored which, when being executed by a processor, carries out the method according to any one of claims 1-5.
CN201811553616.6A 2018-12-19 2018-12-19 Method and apparatus for storing information Pending CN111338810A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201811553616.6A CN111338810A (en) 2018-12-19 2018-12-19 Method and apparatus for storing information

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201811553616.6A CN111338810A (en) 2018-12-19 2018-12-19 Method and apparatus for storing information

Publications (1)

Publication Number Publication Date
CN111338810A true CN111338810A (en) 2020-06-26

Family

ID=71183247

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201811553616.6A Pending CN111338810A (en) 2018-12-19 2018-12-19 Method and apparatus for storing information

Country Status (1)

Country Link
CN (1) CN111338810A (en)

Cited By (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112346891A (en) * 2020-11-26 2021-02-09 北京沃东天骏信息技术有限公司 Message storage method, device, equipment and computer readable medium
CN113590278A (en) * 2021-07-05 2021-11-02 杭州智家通科技有限公司 Method, device, equipment and storage medium for removing repeated execution task
CN113760876A (en) * 2021-02-08 2021-12-07 北京沃东天骏信息技术有限公司 Data filtering method and device
CN114422626A (en) * 2022-01-28 2022-04-29 北京秒如科技有限公司 Protocol transmission method, device and system
CN114518833A (en) * 2020-10-30 2022-05-20 伊姆西Ip控股有限责任公司 Method, electronic device and computer program product for storage management
CN114549072A (en) * 2022-02-18 2022-05-27 杭州网易云音乐科技有限公司 Data processing method, device, storage medium and computing equipment
CN114915663A (en) * 2022-03-21 2022-08-16 北京沃东天骏信息技术有限公司 Request response method, device, system, electronic equipment and medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101295267A (en) * 2008-05-30 2008-10-29 中兴通讯股份有限公司 Queue management method and apparatus, computer system and computer readable medium
CN102340453A (en) * 2011-10-31 2012-02-01 航天恒星科技有限公司 A Scheduling Method for Variable Length Data Stream
CN103227747A (en) * 2012-03-14 2013-07-31 微软公司 High density hosting for messaging service
CN106250250A (en) * 2016-08-09 2016-12-21 广州唯品会信息科技有限公司 Data communications method and device
CN106330766A (en) * 2016-08-16 2017-01-11 中国银联股份有限公司 Message transmitting method and apparatus
CN107943562A (en) * 2017-11-14 2018-04-20 广东欧珀移动通信有限公司 Information storage method, device, storage medium and electronic equipment
CN108073355A (en) * 2016-11-15 2018-05-25 杭州海康威视数字技术股份有限公司 A kind of data storage and delet method and device
CN108933993A (en) * 2018-07-03 2018-12-04 平安科技(深圳)有限公司 Short message buffer queue selection method, device, computer equipment and storage medium
CN108965164A (en) * 2017-05-17 2018-12-07 北京京东尚科信息技术有限公司 Service request repeating method, device and readable storage medium storing program for executing based on message queue

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN101295267A (en) * 2008-05-30 2008-10-29 中兴通讯股份有限公司 Queue management method and apparatus, computer system and computer readable medium
CN102340453A (en) * 2011-10-31 2012-02-01 航天恒星科技有限公司 A Scheduling Method for Variable Length Data Stream
CN103227747A (en) * 2012-03-14 2013-07-31 微软公司 High density hosting for messaging service
CN106250250A (en) * 2016-08-09 2016-12-21 广州唯品会信息科技有限公司 Data communications method and device
CN106330766A (en) * 2016-08-16 2017-01-11 中国银联股份有限公司 Message transmitting method and apparatus
CN108073355A (en) * 2016-11-15 2018-05-25 杭州海康威视数字技术股份有限公司 A kind of data storage and delet method and device
CN108965164A (en) * 2017-05-17 2018-12-07 北京京东尚科信息技术有限公司 Service request repeating method, device and readable storage medium storing program for executing based on message queue
CN107943562A (en) * 2017-11-14 2018-04-20 广东欧珀移动通信有限公司 Information storage method, device, storage medium and electronic equipment
CN108933993A (en) * 2018-07-03 2018-12-04 平安科技(深圳)有限公司 Short message buffer queue selection method, device, computer equipment and storage medium

Cited By (8)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN114518833A (en) * 2020-10-30 2022-05-20 伊姆西Ip控股有限责任公司 Method, electronic device and computer program product for storage management
CN114518833B (en) * 2020-10-30 2024-05-03 伊姆西Ip控股有限责任公司 Method, electronic device and computer program product for storage management
CN112346891A (en) * 2020-11-26 2021-02-09 北京沃东天骏信息技术有限公司 Message storage method, device, equipment and computer readable medium
CN113760876A (en) * 2021-02-08 2021-12-07 北京沃东天骏信息技术有限公司 Data filtering method and device
CN113590278A (en) * 2021-07-05 2021-11-02 杭州智家通科技有限公司 Method, device, equipment and storage medium for removing repeated execution task
CN114422626A (en) * 2022-01-28 2022-04-29 北京秒如科技有限公司 Protocol transmission method, device and system
CN114549072A (en) * 2022-02-18 2022-05-27 杭州网易云音乐科技有限公司 Data processing method, device, storage medium and computing equipment
CN114915663A (en) * 2022-03-21 2022-08-16 北京沃东天骏信息技术有限公司 Request response method, device, system, electronic equipment and medium

Similar Documents

Publication Publication Date Title
CN111338810A (en) Method and apparatus for storing information
CN109582873B (en) Method and device for pushing information
CN107302597B (en) Message file pushing method and device
US20170109371A1 (en) Method and Apparatus for Processing File in a Distributed System
CN112948138B (en) A method and device for processing messages
US20200004464A1 (en) Method and apparatus for storing data
CN108933822B (en) Method and device for processing information
CN109873863B (en) Asynchronous invocation method and device for service
CN111104479A (en) Data labeling method and device
CN108933695B (en) Method and apparatus for processing information
CN108011949B (en) Method and apparatus for acquiring data
CN113704222B (en) A method and device for processing a service request
CN110766348B (en) Method and device for combining goods picking tasks
CN110119418B (en) Data export method and device
CN111178696A (en) Service processing time overtime early warning method and device
CN113127561B (en) Method and device for generating service single number, electronic equipment and storage medium
CN112348612B (en) Order generation method and device
CN105359117A (en) Mail server, mail transmission/reception method, and mail transmission/reception program
CN109087097B (en) Method and device for updating same identifier of chain code
CN114912111B (en) A cloud host virus detection method, device and system
CN109213815B (en) Method, device, server terminal and readable medium for controlling execution times
CN111414566B (en) Method and device for pushing information
CN117333170A (en) Service processing method, device, electronic equipment and storage medium
CN118210811A (en) Service processing method, device, electronic equipment and computer readable medium
RU2698766C1 (en) Method and device for transmitting, sending and receiving information

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