CN113158096B - Data processing method, device, medium and electronic equipment - Google Patents

Data processing method, device, medium and electronic equipment Download PDF

Info

Publication number
CN113158096B
CN113158096B CN202110529849.8A CN202110529849A CN113158096B CN 113158096 B CN113158096 B CN 113158096B CN 202110529849 A CN202110529849 A CN 202110529849A CN 113158096 B CN113158096 B CN 113158096B
Authority
CN
China
Prior art keywords
elements
user identifier
data
storage
queue
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN202110529849.8A
Other languages
Chinese (zh)
Other versions
CN113158096A (en
Inventor
方嘉铭
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Netease Hangzhou Network Co Ltd
Original Assignee
Netease Hangzhou Network 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 Netease Hangzhou Network Co Ltd filed Critical Netease Hangzhou Network Co Ltd
Priority to CN202110529849.8A priority Critical patent/CN113158096B/en
Publication of CN113158096A publication Critical patent/CN113158096A/en
Application granted granted Critical
Publication of CN113158096B publication Critical patent/CN113158096B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/90Details of database functions independent of the retrieved data types
    • G06F16/95Retrieval from the web
    • G06F16/955Retrieval from the web using information identifiers, e.g. uniform resource locators [URL]

Landscapes

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

Abstract

The present disclosure relates to the field of computers, and in particular, to a data processing method, apparatus, computer-readable storage medium, and electronic device, including: acquiring a plurality of data, a user identifier and a plurality of elements in each data, and acquiring the storage capacity of an element sequence; when the fields of the plurality of elements are smaller than or equal to the storage capacity, storing the plurality of elements in an element sequence, and generating an ordered queue of a plurality of data according to the user identifier and the element sequence; when the fields of the elements are larger than the storage capacity, storing a set of the elements smaller than the storage capacity into an element sequence, storing a set of additional elements larger than the storage capacity as character strings, integrating the character strings and user identifiers to obtain character user identifications, and generating an ordered queue of a plurality of data according to the character user identifications and the element sequence. Through the technical scheme of the embodiment of the disclosure, the problems that the data are sequenced, the display information is too little, and the data cannot be sequenced correctly in part of application scenes can be solved.

Description

Data processing method, device, medium and electronic equipment
Technical Field
The present disclosure relates to the field of computers, and in particular, to a data processing method, a data processing apparatus, a computer-readable storage medium, and an electronic device.
Background
With the rapid development of the internet, data generated by various services and required by various services are increasing, and in some application scenarios, the data needs to be sorted. For example, in network games, players often need to be ranked according to some specific attributes of the players, such as ranking according to attributes of rank, score, fighting power, and the like.
In the related art, with the rise of a memory-based data structure type database such as redis, more and more developers adopt an ordered set sortedset data structure provided by redis to realize game ranking. With the mining of sortedset in the industry, it is found that when sortedset is used to represent integers, only 53 significant bits are available, and when players are ranked, fields of information related to sortedset are greater than 53 significant bits, and all fields cannot be represented. Therefore, in the related art, only relatively important information is generally selected to be shown to satisfy 53 significant bits.
However, with the development of the game industry, players cannot meet the requirement that only single information is displayed in the ranking list, and when ranking is performed by using the single information, if the single information of two or more players is the same, the ranking cannot be performed well, so that the players are dissatisfied.
It is to be noted that the information disclosed in the above background section is only for enhancement of understanding of the background of the present disclosure, and thus may include information that does not constitute prior art known to those of ordinary skill in the art.
Disclosure of Invention
The present disclosure is directed to a data processing method, a data processing apparatus, a computer readable storage medium, and an electronic device, which can solve the problem that sequencing display information for data is too little and correct sequencing cannot be performed in some application scenarios.
Additional features and advantages of the disclosure will be set forth in the detailed description which follows, or in part will be obvious from the description, or may be learned by practice of the disclosure.
According to a first aspect of the present disclosure, there is provided a data processing method, including: acquiring a plurality of data, a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of an element sequence; wherein the sequence of elements is used to store the elements; when the fields of the plurality of elements are less than or equal to the storage capacity, storing the plurality of elements in an element sequence, and generating an ordered queue of the plurality of data according to the user identifier and the element sequence; when the fields of the elements are larger than the storage capacity, storing a set of the elements smaller than the storage capacity into the element sequence, storing a set of additional elements larger than the storage capacity as character strings, integrating the character strings and the user identifiers to obtain character user identifications, and generating the ordered queue of the data according to the character user identifications and the element sequence.
In an exemplary embodiment of the disclosure, based on the foregoing scheme, the generating the ordered queue of the plurality of data according to the user identifier and the element sequence includes: generating a first storage queue according to the user identifier and the element sequence, and acquiring a first designated element in the plurality of elements; and sequencing the first storage queues according to the numerical values of the fields of the first designated elements in the first storage queues to generate ordered queues.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the generating the ordered queue of the plurality of data according to the character user identifier and the element sequence includes: generating a second storage queue according to the character user identification and the element sequence, and acquiring a first designated element in the plurality of elements; and sequencing the second storage queues according to the numerical value of the field of the first designated element in each second storage queue to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, when the number value of the field of the first specified element in the second storage queue is the same, the second storage queue is sorted according to the number size of the field of the second specified element; wherein the second specified element comprises one or more elements of the sequence of elements other than the first specified element.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, when the numerical values of the fields of the corresponding elements in each of the element sequences are the same, the second storage queue is sorted according to the character user identifier to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the sorting the second storage queue according to the character user identifier to generate an ordered queue includes: analyzing the character user identifier to obtain a user identifier and a set of additional elements corresponding to the user identifier; and sequencing the second storage queue according to the magnitude relation of the numerical values of the fields of the additional elements in the set of the additional elements to generate an ordered queue.
In an exemplary embodiment of the disclosure, based on the foregoing scheme, the sorting the second storage queue according to the numerical size of the field of the first specified element to generate an ordered queue includes: determining the magnitude relation of the numerical values of the fields of the first specified elements in each second storage queue; and sequencing the second storage queue according to the sequence from large to small to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, a user identifier of the character string corresponding to the character string is obtained; and storing the character strings and the user identifiers corresponding to the character strings as a hash storage structure.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, when the position of the data to be queried corresponding to the user identifier in the ordered queue is determined by the user identifier, a one-to-one mapping relationship between the user identifier and the character string in the hash storage structure is obtained; acquiring a character string corresponding to the user identifier according to the one-to-one mapping relation of the user identifier and the character string; and determining the character user identification according to the character string, and determining the position of the data to be queried in the ordered queue according to the character user identification.
According to a second aspect of the present disclosure, there is provided a data processing apparatus, the apparatus comprising: the data acquisition module is used for acquiring a plurality of data, a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of an element sequence; wherein the sequence of elements is used to store the elements; a first ordered queue generating module, configured to store the plurality of elements in an element sequence when a field of the plurality of elements is less than or equal to the storage capacity, and generate an ordered queue of the plurality of data according to the user identifier and the element sequence; and the second ordered queue generating module is used for storing a set of elements smaller than the storage capacity into the element sequence when the fields of the elements are larger than the storage capacity, storing a set of additional elements larger than the storage capacity into a character string, integrating the character string and the user identifier to obtain a character user identifier, and generating the ordered queue of the data according to the character user identifier and the element sequence.
According to a third aspect of the present disclosure, there is provided a computer-readable storage medium, on which a computer program is stored, which program, when executed by a processor, implements the data processing method according to the first aspect of the embodiments described above.
According to a fourth aspect of the present disclosure, there is provided an electronic device comprising:
a processor; and
memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the data processing method as described in the first aspect of the embodiments above.
The technical scheme provided by the embodiment of the disclosure can have the following beneficial effects:
in the data processing method provided by an embodiment of the present disclosure, a plurality of data and a plurality of elements corresponding to a user identifier and the user identifier in each data may be obtained, and a storage capacity of an element sequence may be obtained, storing the plurality of elements in a sequence of elements when a field of the plurality of elements is less than or equal to the storage capacity, and generating an ordered queue of the plurality of data from the user identifier and the sequence of elements, storing a set of elements smaller than the storage capacity into the sequence of elements when a field of the plurality of elements is larger than the storage capacity, and storing a set of additional elements larger than said storage capacity as a string, integrating said string with said user identifier to obtain a character user identification, and generating the ordered queue of the plurality of data according to the character user identification and the element sequence.
According to the embodiment of the disclosure, when the storage capacity of the element sequence is fixed, the additional elements larger than the element sequence are stored as the character strings, and the character strings and the user identifiers are integrated and sequenced to obtain the ordered queue. On one hand, when data are sequenced, more elements can be displayed in the ordered queue, and more information can be received according to the data ranking, so that the problem of accepting or rejecting part of elements during data sequencing is avoided; on the other hand, the data can be sequenced according to a plurality of elements and character strings in the element sequence, and the problem that the data cannot be sequenced under the condition that one element is the same is avoided.
It is to be understood that both the foregoing general description and the following detailed description are exemplary and explanatory only and are not restrictive of the disclosure.
Drawings
The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present disclosure and together with the description, serve to explain the principles of the disclosure. It is to be understood that the drawings in the following description are merely exemplary of the disclosure, and that other drawings may be derived from those drawings by one of ordinary skill in the art without the exercise of inventive faculty. In the drawings:
FIG. 1 schematically illustrates a schematic diagram of an exemplary system architecture for a data processing method in an exemplary embodiment of the disclosure;
FIG. 2 schematically illustrates a flow chart of a data processing method in an exemplary embodiment of the disclosure;
FIG. 3 schematically illustrates a schematic diagram of a data storage structure in an exemplary embodiment of the present disclosure;
FIG. 4 is a flow chart schematically illustrating sorting a first storage queue according to the size of a numerical value corresponding to a field of a first specified element to generate an ordered queue according to an exemplary embodiment of the present disclosure;
FIG. 5 schematically illustrates a schematic diagram of another data storage structure in an exemplary embodiment of the disclosure;
FIG. 6 is a flow chart schematically illustrating sorting the second storage queue according to the magnitude of the value corresponding to the field of the first specified element to generate an ordered queue according to an exemplary embodiment of the present disclosure;
FIG. 7 is a flow chart schematically illustrating sorting the second storage queue according to the magnitude relationship of the numerical values corresponding to the fields of the additional elements to generate an ordered queue according to an exemplary embodiment of the present disclosure;
FIG. 8 is a flow diagram that schematically illustrates sorting the second store queue in a descending order to generate an ordered queue, in an exemplary embodiment of the disclosure;
fig. 9 schematically illustrates a flowchart of storing a character string and a user identifier corresponding to the character string as a hash storage structure in an exemplary embodiment of the present disclosure;
FIG. 10 is a flow chart that schematically illustrates determining a character user identifier from a character string and determining a location of data to be queried in an ordered queue according to the character user identifier in an exemplary embodiment of the present disclosure;
FIG. 11 is a schematic diagram schematically illustrating the determination of the location of data to be queried according to a user identifier in an exemplary embodiment of the disclosure;
fig. 12 schematically shows a composition diagram of a data processing apparatus in an exemplary embodiment of the present disclosure;
fig. 13 schematically shows a schematic structural diagram of a computer system of an electronic device suitable for implementing an exemplary embodiment of the present disclosure.
Detailed Description
Example embodiments will now be described more fully with reference to the accompanying drawings. Example embodiments may, however, be embodied in many different forms and should not be construed as limited to the examples set forth herein; rather, these embodiments are provided so that this disclosure will be thorough and complete, and will fully convey the concept of example embodiments to those skilled in the art. The described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. Furthermore, the described features, structures, or characteristics may be combined in any suitable manner in one or more embodiments. In the following description, numerous specific details are provided to give a thorough understanding of embodiments of the disclosure. One skilled in the relevant art will recognize, however, that the subject matter of the present disclosure can be practiced without one or more of the specific details, or with other methods, components, devices, steps, and so forth. In other instances, well-known structures, methods, devices, implementations, materials, or operations are not shown or described in detail to avoid obscuring aspects of the disclosure.
The block diagrams shown in the figures are functional entities only and do not necessarily correspond to physically separate entities. That is, these functional entities may be implemented in software, or in one or more software-hardened modules, or in different networks and/or processor devices and/or microcontroller devices.
Fig. 1 shows a schematic diagram of an exemplary system architecture to which the data processing method of the embodiments of the present disclosure may be applied.
As shown in fig. 1, the system architecture 1000 may include one or more of terminal devices 1001, 1002, 1003, a network 1004, and a server 1005. The network 1004 is used to provide a medium for communication links between the terminal devices 1001, 1002, 1003 and the server 1005. Network 1004 may include various connection types, such as wired, wireless communication links, or fiber optic cables, to name a few.
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. For example, the server 1005 may be a server cluster composed of a plurality of servers.
A user can interact with a server 1005 via a network 1004 using terminal devices 1001, 1002, 1003 to receive or transmit messages or the like. The terminal devices 1001, 1002, 1003 may be various electronic devices having a display screen, including but not limited to smart phones, tablet computers, portable computers, desktop computers, and the like. In addition, the server 1005 may be a server that provides various services.
In one embodiment, the execution subject of the data processing method of the present disclosure may be a server 1005, and the server 1005 may acquire a plurality of data transmitted by the terminal apparatuses 1001, 1002, 1003 and a plurality of elements and storage capacities of element sequences corresponding to the user identifier and the user identifier in each data, storing the plurality of elements in a sequence of elements when the fields of the plurality of elements are less than or equal to the storage capacity, and generating an ordered queue of a plurality of data from the user identifier and the sequence of elements, when a field of the plurality of elements is larger than the storage capacity, storing a set of elements smaller than the storage capacity into the sequence of elements, and storing the set of additional elements with the capacity larger than the storage capacity as a character string, integrating the character string and the user identifier to obtain a character user identifier, and generating a plurality of ordered queues of data according to the character user identifier and the element sequence. Further, the data processing method of the present disclosure may also be executed by the terminal devices 1001, 1002, 1003, and the like to realize a process of generating an ordered queue according to a size relationship of fields of a plurality of elements and a storage capacity of an element sequence.
In addition, the implementation process of the data processing method of the present disclosure may also be implemented by the terminal devices 1001, 1002, 1003 and the server 1005 together. For example, the terminal devices 1001, 1002, 1003 may acquire a plurality of data and a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquires the storage capacity of the element sequence, transmits the acquired user identifier and a plurality of elements corresponding to the user identifier and the storage capacity of the element sequence to the server 1005, so that the server 1005 can store the plurality of elements in the sequence of elements when the fields of the plurality of elements are less than or equal to the storage capacity, and generate an ordered queue of a plurality of data from the user identifier and the sequence of elements, storing a set of elements smaller than the storage capacity into the sequence of elements when the fields of the plurality of elements are larger than the storage capacity, and storing the set of the additional elements larger than the storage capacity as a character string, integrating the character string and the user identifier to obtain a character user identifier, and generating an ordered queue of a plurality of data according to the character user identifier and the element sequence.
With the development of a data structure type database based on a redis memory, due to the efficient performance of the database, the realization of the ranking list in the game is also changed from the original complex multi-process realization to a data structure of an ordered set sortedset using the redis, and with the mining of the data structure by the industry boundary, only 53 effective bit digits are found when the sortedset is used for representing an integer.
With the rapid development of network games, it is often necessary to rank according to some attributes of players, such as level, time, fighting power, etc. The player is not satisfied to show only a single attribute in the leaderboard, for example, only the player ID and the corresponding rating are shown, and it is necessary to obtain information of multiple other attributes corresponding to the player, such as fighting power, player gender, game duration, score, and the like, while showing the player ID.
Second, in the related art, if single attributes of two or more players are the same, ranking may be sequentially performed according to the importance degree of the attributes at the time of ranking. For example, ranking may be based on the player's rank, may be based on the time to reach this rank when the ranks are the same (fewer ranks higher when used), may be based on the player's battle power when the time to reach this rank is the same, and so on. Therefore, multiple fields are required to store the attribute information during sorting, and each field occupies multiple bits.
Therefore, because sortedset provided by redis can only handle presentation and ordering problems with less than or equal to 53 significant bits, current traffic requirements cannot be met.
According to the method of the hyper-resolution model provided in the exemplary embodiment, when a plurality of data and a plurality of elements corresponding to a user identifier and a user identifier in each data are obtained, and the storage capacity of an element sequence is obtained, when fields of the plurality of elements are smaller than or equal to the storage capacity, the plurality of elements are stored in the element sequence, an ordered queue of the plurality of data is generated according to the user identifier and the element sequence, when the fields of the plurality of elements are larger than the storage capacity, a set of the elements smaller than the storage capacity is stored in the element sequence, a set of additional elements larger than the storage capacity is stored as a character string, the character string and the user identifier are integrated to obtain a character user identifier, and the ordered queue of the plurality of data is generated according to the character user identifier and the element sequence. As shown in fig. 2, the data processing method may include the steps of:
step S210, acquiring a plurality of data and a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of an element sequence; wherein the element sequence is used for storing the elements;
step S220, when the fields of the elements are smaller than or equal to the storage capacity, storing the elements in an element sequence, and generating an ordered queue of a plurality of data according to the user identifier and the element sequence;
step S230, when the fields of the plurality of elements are larger than the storage capacity, storing the set of the elements smaller than the storage capacity into the element sequence, storing the set of the additional elements larger than the storage capacity as character strings, integrating the character strings and the user identifiers to obtain character user identifications, and generating an ordered queue of a plurality of data according to the character user identifications and the element sequence.
In the data processing method provided by the present exemplary embodiment, when a plurality of data and a plurality of elements corresponding to a user identifier and a user identifier in each data are acquired, and a storage capacity of an element sequence is acquired, when fields of the plurality of elements are less than or equal to the storage capacity, the plurality of elements are stored in the element sequence, an ordered queue of the plurality of data is generated according to the user identifier and the element sequence, when the fields of the plurality of elements are greater than the storage capacity, a set of the elements less than the storage capacity is stored in the element sequence, a set of additional elements greater than the storage capacity is stored as a character string, a character user identifier is obtained by integrating the character string and the user identifier, and an ordered queue of the plurality of data is generated according to the character user identifier and the element sequence.
According to the embodiment of the disclosure, when the storage capacity of the element sequence is fixed, the additional elements larger than the element sequence are stored as the character strings, and the character strings and the user identifiers are integrated and sequenced to obtain the ordered queue. On one hand, when data are sequenced, more elements can be displayed in the ordered queue, and more information can be received according to the data ranking, so that the problem of accepting or rejecting part of elements during data sequencing is avoided; on the other hand, the data can be sequenced according to a plurality of elements and character strings in the element sequence, and the problem that the data cannot be sequenced under the condition that one element is the same is avoided.
Next, steps S210 to S230 of data processing in the present exemplary embodiment will be described in more detail with reference to the drawings and the embodiment.
Step S210, acquiring a plurality of data and a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of an element sequence; wherein the element sequence is used for storing the elements;
in an example embodiment of the present disclosure, the data may include data generated in various network services or data required by various network services. In particular, the data includes data that may be sorted. The data may include a user identifier and a plurality of elements to which the user identifier corresponds. Specifically, the user identifier may be used to indicate an object corresponding to the data, and the element may include at least one attribute information corresponding to the user identifier. Further, the elements are set based on the user identifier.
For example, for a certain network game, the user identifier may include a player nickname, a player number, a player account, etc., and the elements corresponding to the user identifier may include a score, a level, a time required to reach a certain level, a fighting power, a maximum level, a time required for clearance, a character score, etc.; for a certain e-commerce platform, the user identifier may include a user nickname, a user account, a user associated mobile phone number, and the like, and the elements corresponding to the user identifier may include monthly consumption, quarterly consumption, annual consumption, user gender, purchased commodity category, purchase time period, and purchased article price interval; for a certain social software, the user identifier may include a user nickname, a user account, a user-associated device fixed address, a user-associated mobile phone account, and the like, and the elements corresponding to the user identifier may include the number of listened persons, the number of messages sent monthly, the number of messages sent quarterly, the number of messages sent annually, the input speed, the activity in the group, the number of praised, the number of praise, the movement data, and the like. It should be noted that the present disclosure is not limited to an application scenario, that is, the present disclosure is not limited to a user identifier and a specific type of an element corresponding to the user identifier, and the present disclosure may be adjusted according to a specific application scenario.
In an example embodiment of the present disclosure, an element corresponding to a user identifier may be stored in a sequence of elements. In particular, the element sequence has a fixed storage capacity, i.e. only a few elements of the element sequence can be stored. For example, sortedset is provided in the redis database, when integers are stored in the sortedset, only 53 significant bits can be stored, for a certain online game, a level needs to be represented by 10 significant bits, a timestamp reaching the level needs to be represented by 32 significant bits, and fighting capacity needs to be represented by 32 significant bits, at this time, an element sequence with fixed storage capacity can only store two elements of the level and the timestamp reaching the level. It should be noted that the storage capacity of the element sequence is not particularly limited in the present disclosure.
In an example embodiment of the present disclosure, a plurality of data and a user identifier in each data and a plurality of elements corresponding to the user identifier may be acquired, and a storage capacity of an element sequence may be acquired. Specifically, a plurality of data can be acquired in real time when the data needs to be sorted, or the data can be acquired at regular time, the acquired data is stored in a memory of the server or the terminal device, and when the data needs to be sorted, the latest acquired data is called in the memory of the server or the terminal device to be sorted.
In an example embodiment of the present disclosure, when data is acquired, a plurality of elements corresponding to a user identifier may be acquired. Specifically, the element corresponding to the user identifier may be obtained according to a preset rule, or all elements corresponding to the user identifier may be determined first, and the required element may be determined according to the service scenario. For example, for a certain formation action network game, the elements corresponding to the user identifier may include a rank, time required to achieve a certain rank, a fighting capacity, a maximum pass of the copy, time required for clearance, and a score of the copy, and when a ranking list is made for the attack and stiffness conditions of a newly opened copy at a certain time, the more important elements are the maximum pass of the copy, the time required for clearance, and the score of the copy, so that the maximum pass of the copy, the time required for clearance, and the score of the copy may be determined as a plurality of elements corresponding to the user identifier at this time; when the comprehensive abilities of the players in a certain large area are ranked, the more important elements are the level, the time required for achieving a certain level and the fighting capacity, so that the level, the time required for achieving a certain level and the fighting capacity can be determined as a plurality of elements corresponding to the user identifier. It should be noted that, in the present disclosure, the method for determining the element is not particularly limited, and may be adjusted according to a service scenario.
Step S220, when the fields of the elements are smaller than or equal to the storage capacity, storing the elements in an element sequence, and generating an ordered queue of a plurality of data according to the user identifier and the element sequence;
in an example embodiment of the present disclosure, the plurality of elements may be stored in the sequence of elements when a field of the plurality of elements is less than or equal to a storage capacity. Specifically, a plurality of elements corresponding to the user identifier in each data may be acquired first, then fields corresponding to the plurality of elements may be acquired, and then the fields of the plurality of elements may be added, and when the fields of the plurality of elements are less than or equal to the storage capacity, it may be indicated that the element sequence is sufficient to store the plurality of elements.
In an example embodiment of the present disclosure, an ordered queue of a plurality of data may be generated from a user identifier and a sequence of elements. Specifically, the elements in the element sequence may be sorted, and the sorted result is displayed as an ordered queue in the form of a user identifier-element sequence. That is, the element sequences may be sorted first, then the user identifiers corresponding to the sorted element sequences are obtained, and the user identifiers and the element sequences are represented in the form of user identifier-element sequences. Specifically, when the elements in the element sequence are sorted, the element sequence may be sorted according to the numerical value corresponding to the field of the element. For example, the user identifier and the element sequence may be stored in a form of key, value, as shown in fig. 3, the key stores the user identifier, the value stores the element sequence, and the element sequence includes a1, a2, a3... an, and occupies b1+ b2+ b3+. + bn, which is the number of valid bits, where b1+ b2+ b3+. + bn may be less than or equal to the storage capacity of the element sequence.
Further, when sorting is performed, the element sequence may be sorted according to the numerical value corresponding to the field of the plurality of elements. For example, for a certain network game, the elements stored in the element sequence are levels, time required to achieve a certain level, and fighting capacity, the ranking is based on the levels, when the levels of two or more players are the same, the two or more players can be ranked according to the time required to achieve the level, the ranking with less time is earlier, and when the times required for two or more players to achieve the level are also the same, the ranking can be performed according to the fighting capacity of the two or more players.
In an example embodiment of the present disclosure, a first storage queue may be generated according to a user identifier and an element sequence, a first designated element of a plurality of elements may be obtained, and the first storage queue may be sorted according to a size of a numerical value corresponding to a field of the first designated element to generate an ordered queue. Referring to fig. 4, sorting the first storage queue according to the size of the value corresponding to the field of the first specified element to generate an ordered queue may include the following steps S410 to S420:
step S410, generating a first storage queue according to the user identifier and the element sequence, and acquiring a first designated element in the plurality of elements;
in an example embodiment of the present disclosure, a first storage queue may be generated from a user identifier and a sequence of elements. Specifically, a plurality of elements in the element sequence exist based on the user identifier, that is, the user identifier corresponds to a plurality of elements, so that the user identifier can be associated with the element sequence to generate the first storage queue of a plurality of data in the form of a user identifier-element sequence.
For example, three data are obtained, data a includes a user identifier a, an element sequence includes an element a1, an element a2, and an element a3, data B includes a user identifier B, an element sequence includes an element B1, an element B2, and an element B3, data C includes a user identifier C, and an element sequence includes an element C1, an element C2, and an element C3, at this time, a first storage queue may be generated according to the user identifier and the element sequence, which is represented as follows: user identifier a-element a1, element a2, element a3, user identifier b-element b1, element b2, element b3, user identifier c-element c1, element c2, element c 3.
Further, the first storage queue is not sorted according to a specific order, the front-back order of the association relationship between the plurality of user identifiers and the element sequence in the first storage queue may be set randomly, or the association relationship between the plurality of user identifiers and the element sequence in the first storage queue may be sorted according to the order of data acquisition. It should be noted that, the order of the association relationship between the plurality of user identifiers and the element sequence in the first storage queue is not particularly limited in the present disclosure.
In an example embodiment of the present disclosure, a first specified element of a plurality of elements may be obtained. Specifically, the first storage queue may be sorted according to a first specified element, that is, the first specified element may include an element that is important for ranking. The method includes the steps that a sorting rule can be set in advance, the sorting rule comprises a first designated element, the sorting rule is stored in a memory of the server or the terminal device, and the first designated element can be obtained from the memory of the server or the terminal device when data needs to be ranked. It should be noted that the manner of acquiring the first designated element in the present disclosure is not particularly limited.
Step S420, sorting the first storage queues according to the numerical values of the fields of the first designated elements in the first storage queues to generate ordered queues.
In an example embodiment of the present disclosure, the first storage queue may be sorted according to a size of a numerical value corresponding to a field of the first specified element to generate the ordered queue. Specifically, a first designated element in each element sequence may be obtained in the first storage queue, a numerical value corresponding to a field corresponding to the first designated element in each element sequence may be obtained, and the first storage queue may be sorted according to the size of the numerical value corresponding to the field of the first designated element to generate an ordered queue, where the ordered queue may include an association relationship between a user identifier and the element sequence, and the association relationship between the user identifier and the element sequence is sorted according to the size of the numerical value corresponding to the field of the first designated element.
Specifically, the first storage queues may be sorted in an order from large to small of the numerical values corresponding to the fields of the first designated element, or the first storage queues may be sorted in an order from small to large of the numerical values corresponding to the fields of the first designated element. It should be noted that the present disclosure is not limited to the sorting manner.
Further, when the first storage queue is sorted according to the value size of the field, the field with a larger value can be sorted in front of the ascending field; for descending fields, the smaller value of the field may be ranked first. For example, in the case of a network game, when ranking is performed according to the rank, the rank with the highest rank needs to be ranked first, and when the ranks are the same, the time required to achieve the ranks needs to be ranked first. Thus, when preceding fields with smaller values, the values of these fields may be subtracted once for the descending fields. For example, if the time required to achieve the level occupies 32 significant bits, the time required to achieve the level may be stored as 2^32-1-t (time required to achieve the level).
Through the steps S410 to S420, a first storage queue may be generated according to the user identifier and the element sequence, a first designated element of the plurality of elements may be obtained, and the first storage queue may be sorted according to the size of the numerical value corresponding to the field of the first designated element to generate an ordered queue.
Step S230, when the fields of the plurality of elements are larger than the storage capacity, storing the set of the elements smaller than the storage capacity into the element sequence, storing the set of the additional elements larger than the storage capacity as character strings, integrating the character strings and the user identifiers to obtain character user identifications, and generating an ordered queue of a plurality of data according to the character user identifications and the element sequence.
In an example embodiment of the present disclosure, when a field of a plurality of elements is larger than a storage capacity, a set of elements smaller than the storage capacity may be stored into the element sequence, and a set of additional elements larger than the storage capacity may be stored as a character string. Specifically, a plurality of elements corresponding to the user identifier in each data may be acquired first, then fields corresponding to the plurality of elements may be acquired, and then the fields of the plurality of elements may be added, and when the fields of the plurality of elements are larger than the storage capacity, it indicates that the element sequence is insufficient to store the plurality of elements, and therefore, a set of elements smaller than the storage capacity may be stored in the element sequence. And stores a set of additional elements larger than the storage capacity as a string. Specifically, the character string is a string of characters consisting of numbers, letters, and underlines. Further, the fields of the additional elements may be expressed in a 16-ary manner. In the present disclosure, the form of storing the character string and the form of the character string are not particularly limited.
For example, for a certain network game, when a plurality of data are sorted, the obtained user identifier is a player ID, elements corresponding to the player ID include a level, time required to reach the level, and fighting capacity, the level needs to occupy 10 significant bits, the time required to reach the level needs to occupy 32 significant bits, the fighting capacity needs to occupy 24 significant bits, the storage capacity of the element sequence is 53 significant bits, and two elements, i.e., the level smaller than 53 significant bits and the time required to reach the level, can be stored in the element sequence. At this time, since the element-battle power is not sufficient to be stored in the element sequence, the element-battle power may be stored as a character string.
In an example embodiment of the present disclosure, after storing a set of elements smaller than a storage capacity into an element sequence and storing a set of additional elements larger than the storage capacity as a character string, the character string and a user identifier may be integrated to obtain a character user identifier, and an ordered queue of a plurality of data is generated according to the character user identifier and the element sequence. Specifically, the character string and the user identifier may be combined to generate the character user identifier. For example, the obtained string is v1, and the user identifier is player1, in this case, the string v1 and the user identifier player1 may be integrated into a character user identifier v1_ player 1. Further, in the integration, the character string may be set in the first half of the character user identification. In the present disclosure, the manner of merging the merge string and the user identifier is not particularly limited. As shown in fig. 5, the key stores a character user identifier v1_ P1, and the value stores an element sequence, wherein the element sequence comprises a1, a2 and a3, and occupies a total number of significant bits b1+ b2+ b3, and b1+ b2+ b3 is less than or equal to the storage capacity of the element sequence.
In an example embodiment of the present disclosure, after the character user identifier is obtained according to the above steps, an ordered queue of a plurality of data may be generated by the character user identifier and the element sequence. Specifically, the elements in the element sequence may be sorted, and the sorted result is displayed as an ordered queue in the form of a character user identifier-element sequence. The element sequence may be sorted first, then the character user identifier corresponding to the sorted element sequence is obtained, and the character user identifier and the element sequence are represented in a form of character user identifier-element sequence. Specifically, when the elements in the element sequence are sorted, the element sequence may be sorted according to the numerical value corresponding to the field of the element.
In an example embodiment of the present disclosure, when performing sorting, the element sequence may be sorted according to a numerical value corresponding to a field of the plurality of elements. For example, for a certain network game, the elements stored in the element sequence are levels, time required to achieve a certain level, and fighting capacity, the ranking is based on the levels, when the levels of two or more players are the same, the two or more players can be ranked according to the time required to achieve the level, the ranking with less time is earlier, and when the times required for two or more players to achieve the level are also the same, the ranking can be performed according to the fighting capacity of the two or more players.
Further, if the numerical values corresponding to the fields of all the elements in each element sequence are the same, the sequence may be further sorted according to the character strings in the character user identifiers corresponding to each element sequence. Specifically, the character string may be restored to obtain a field corresponding to the element, and the element sequence may be sorted according to the value corresponding to the field.
In an example embodiment of the present disclosure, a second storage queue may be generated according to a character user identifier and an element sequence, a first specified element of a plurality of elements may be obtained, and the second storage queue may be sorted according to a numerical value corresponding to a field of the first specified element to generate an ordered queue. Referring to fig. 6, sorting the second storage queue according to the size of the value corresponding to the field of the first specified element to generate an ordered queue may include the following steps S610 to S620:
step S610, generating a second storage queue according to the character user identification and the element sequence, and acquiring a first designated element in the plurality of elements;
in an example embodiment of the present disclosure, a second storage queue may be generated according to the character user identifier and the element sequence, and the first specified element may be obtained. Specifically, a plurality of elements in the element sequence exist based on the character user identifier, that is, the character user identifier corresponds to a plurality of elements, so that the character user identifier and the element sequence can be associated to generate a second storage queue of a plurality of data in the form of a character user identifier-element sequence. Further, the first store queue is not ordered in a particular order.
For example, three data are obtained, data a includes a character user identifier v1_ player1, an element sequence includes an element a1, an element a2, and an element a3, data B includes a character user identifier v2_ player2, an element sequence includes an element B1, an element B2, and an element B3, data C includes a character user identifier v3_ player3, and an element C1, an element C2, and an element C3, at this time, a second storage queue may be generated according to the character user identifiers and the element sequence, which is represented as follows: the character user identification v1_ player 1-element a1, element a2 and element a3, the character user identification v2_ player 2-element b1, element b2 and element b3, and the character user identification v3_ player 3-element c1, element c2 and element c 3.
Step S620, sort the second storage queue according to the value corresponding to the field of the first designated element to generate an ordered queue.
In an example embodiment of the present disclosure, the ordered queue may be generated by sorting the second storage queue according to the size of the numerical value corresponding to the field of the first specified element. Specifically, a first designated element in each element sequence may be obtained in the second storage queue, a numerical value corresponding to a field corresponding to the first designated element in each element sequence may be obtained, the second storage queue may be sorted according to the size of the numerical value corresponding to the field of the first designated element to generate an ordered queue, the ordered queue may include an association relationship between the character user identifier and the element sequence, and the association relationship between the character user identifier and the element sequence may be sorted according to the size of the numerical value corresponding to the field of the first designated element.
Specifically, the second storage queues may be sorted in an order from large to small of the numerical values corresponding to the fields of the first designated element, or the second storage queues may be sorted in an order from small to large of the numerical values corresponding to the fields of the first designated element. It should be noted that the present disclosure is not limited to the sorting manner.
Through the steps S610 to S620, a second storage queue may be generated according to the character user identifier and the element sequence, a first designated element of the plurality of elements may be obtained, and the second storage queue may be sorted according to the numerical value corresponding to the field of the first designated element to generate an ordered queue.
In an example embodiment of the present disclosure, when the numerical values of the fields corresponding to the first specified element are the same, the second storage queue may be sorted according to the numerical value of the field of the second specified element to generate the ordered queue. Specifically, when the numerical values of the fields corresponding to the first specified element are the same, it indicates that the second storage queue cannot be sorted according to the first specified element, and at this time, the second storage queue needs to be sorted according to other elements, that is, one or more elements except the first specified element in the element sequence can be obtained as the second specified element to sort the second storage queue. Specifically, an element may be selected from the element sequence as a second specified element to sort the second storage sequence, and when the second specified elements in the plurality of element sequences are the same, other elements in the element sequence may be obtained to sort the second storage sequence.
For example, the second storage queue obtained is: the character user identification v1_ player 1-element a1, element b1 and element c1, the character user identification v2_ player 2-element a2, element b2 and element c2, and the character user identification v3_ player 3-element a3, element b3 and element c 3. When the first designated element is a, when the first designated element is sorted, it is found that a1 is a2 is a3, at this time, the second storage queue cannot be sorted according to the first designated element a, a second designated element b is selected for sorting, it is found that b1> b2 is b3, which indicates that the character user identifier v1_ player 1-element a1, element b1 and element c1 are at the forefront end of the second storage queue, at this time, the second storage queue cannot be sorted according to b, therefore, c is selected as the second designated element in the element sequence to sort the second storage queue, and it is found that c2< c3, that the ordered queue obtained by sorting the second storage queue is the character user identifier v1_ player 1-element a1, element b1 and element 1, the character user identifier v3_ player element 3-a 3, element b 6474 and element c3, and the character user identifier v 3-element 3_ player3 is 3, Element b2, element c 2.
In an example embodiment of the present disclosure, when the values of the fields of the corresponding elements in each element sequence are the same, the second storage queue is sorted according to the character user identifier to generate the ordered queue. Specifically, the corresponding numerical values of the fields of the elements in each element sequence are the same, which indicates that the elements in the element sequence in the second storage queue cannot be sorted, and at this time, the second storage queue needs to be sorted according to the character user identifier. Specifically, the character user identifiers may be separated first, and then the second storage queues may be sorted according to the length of the character string, or the character string may be processed first, and the second storage queues may be sorted according to the processed result. It should be noted that, the present disclosure does not make any special limitation on the specific manner of sorting the second storage queue according to the character user identifier.
In an example embodiment of the present disclosure, the character user identifier is analyzed to obtain a user identifier and an additional element corresponding to the user identifier, and the second storage queue is sorted according to a magnitude relationship of a numerical value corresponding to a field of the additional element to generate an ordered queue. Referring to fig. 7, the second storage queue is sorted according to the magnitude relationship of the numerical values corresponding to the fields of the additional elements, so as to generate an ordered queue. The method may include the following steps S710 to S720:
step S710, analyzing the character user identifier to obtain a user identifier and a set of additional elements corresponding to the user identifier;
in an example embodiment of the present disclosure, when the second storage queue is sorted by the user identifier character, the character user identifier may be firstly analyzed to obtain a set of the user identifier and an additional element corresponding to the user identifier. Specifically, the character user identifier may be separated to obtain a character string and a user identifier, and then the character string is restored to obtain a set of additional elements corresponding to the user identifier, where the set of additional elements may include one or more additional elements.
Step S720, sorting the second storage queue according to the magnitude relation of the numerical values of the fields of the additional elements in the set of the additional elements to generate an ordered queue.
In an example embodiment of the present disclosure, after obtaining the set of additional elements according to the above steps, an additional element may be specified in the set of additional elements, and the second storage queue may be sorted according to the value size of the field of the additional element, or the second storage queue may be sorted according to the value size of the field of each additional element in the set of additional elements. Specifically, the additional elements may be selected according to the order of the additional elements in the set of additional elements. Further, if the set of additional elements has only one additional element, the second storage queue is sorted according to the value size of the field of the additional element.
For example, the set of additional elements includes an additional element a and an additional element b, when the second storage queues are sorted, the plurality of second storage queues may be sorted according to the value of the field of the additional element a of each second storage queue, if the values of the fields of the additional elements a of each second storage queue are the same, the next-order additional element b may be selected according to the order of the additional element, and then the plurality of second storage queues are sorted according to the value of the field of the additional element b of each second storage queue.
Further, the second storage queues may be sorted according to the descending order of the numerical values corresponding to the fields of the selected additional elements, or sorted according to the ascending order of the numerical values corresponding to the fields of the selected additional elements. It should be noted that the present disclosure is not limited to the sorting manner.
Through the steps S710 to S720, the character user identifier may be analyzed to obtain the user identifier and the additional element corresponding to the user identifier, and the second storage queue is sorted according to the magnitude relationship of the numerical value corresponding to the field of the additional element to generate the ordered queue.
In an example embodiment of the present disclosure, a size relationship of values of fields of first specified elements in each second storage queue may be obtained, and the second storage queues are sorted in an order from large to small to generate an ordered queue. Referring to fig. 8, sorting the second storage queue in descending order to generate an ordered queue may include the following steps S810 to S820:
step S810, determining the magnitude relation of the numerical values of the fields of the first specified elements in each second storage queue;
in an example embodiment of the present disclosure, a magnitude relationship of values of fields of a first specified element in each second storage queue may be determined. Specifically, a field corresponding to the first specified element in each second storage queue may be obtained first, a numerical value corresponding to the field may be obtained, and after the numerical value corresponding to each second storage queue is obtained, the numerical values may be compared to obtain a size relationship between the plurality of numerical values.
And step S820, sequencing the second storage queue according to the sequence from big to small to generate an ordered queue.
In an example embodiment of the present disclosure, after the size relationship of the numerical values corresponding to the plurality of second storage queues is obtained through the above steps, the second storage queues may be sorted in an order from large to small. For example, for a certain online game, a field corresponding to a first designated element in the second storage queue a is a level, a numerical value corresponding to the level is 99, and a numerical value corresponding to the same field in the second storage queue b is 97, at this time, the second storage queues may be sorted according to the level 99 and the level 97 to obtain the ordered queue second storage queue a and the second storage queue b.
Through the steps S810 to S820, the magnitude relationship of the numerical values of the fields of the first designated elements in each second storage queue can be obtained, and the second storage queues are sorted in the descending order to generate the ordered queue.
In an example embodiment of the present disclosure, a user identifier of a character string corresponding to the character string may be obtained, and the user identifier of the character string corresponding to the character string may be stored as a hash storage structure. Referring to fig. 9, storing the character string and the user identifier corresponding to the character string as a hash storage structure may include the following steps S910 to S920:
step S910, acquiring a character string and a user identifier corresponding to the character string;
in an example embodiment of the present disclosure, a user identifier may be obtained in which a character string corresponds to a character string. Specifically, the character string is obtained by converting according to the set of additional elements corresponding to the user identifier, and therefore, the character string and the user identifier have an association relationship, and therefore, the user identifier corresponding to the character string and the character string can be obtained.
Step S920, storing the character string and the user identifier corresponding to the character string as a hash storage structure.
In an example embodiment of the present disclosure, after the user identifier corresponding to the character string is obtained, the user identifier corresponding to the character string may be stored as a hash storage structure. Specifically, the hash storage structure includes a one-to-one mapping relationship between the user identifier and the character string, that is, the corresponding character string can be found through the user identifier. It should be noted that, the form of the hash storage structure is not particularly limited in the present disclosure, as long as the corresponding character string can be searched according to the user identifier.
Through the steps S910 to S920, the user identifier corresponding to the character string and the character string may be obtained, and the user identifier corresponding to the character string and the character string may be stored as a hash storage structure.
In an example embodiment of the present disclosure, when determining, through a user identifier, a position of data to be queried corresponding to the user identifier in an ordered queue, a one-to-one mapping relationship between the user identifier and a character string in a hash storage structure is obtained, the character string corresponding to the user identifier is obtained according to the one-to-one mapping relationship between the user identifier and the character string, a character user identifier is determined according to the character string, and the position of the data to be queried is determined in the ordered queue according to the character user identifier. Referring to fig. 10, determining a character user identifier according to the character string, and determining a position of data to be queried in the ordered queue according to the character user identifier may include the following steps S1010 to S1020:
step S1010, when the position of the data to be inquired corresponding to the user identifier in the ordered queue is determined through the user identifier, acquiring a one-to-one mapping relation between the user identifier and the character string in a hash storage structure;
in an example embodiment of the present disclosure, when the position of the data to be queried in the ordered queue needs to be determined by the user identifier, the hash storage structure stored in the above step may be obtained first, specifically, the hash storage structure may be stored in a memory of the server or the terminal device, and when the position of the data to be queried in the ordered queue needs to be determined by the user identifier, the hash storage structure may be called in the memory of the server or the terminal device, and a one-to-one mapping relationship between the user identifier and the character string in the hash storage structure is obtained.
Step S1020, acquiring a character string corresponding to the user identifier according to the one-to-one mapping relation between the user identifier and the character string;
step S1030, determining a character user identifier according to the character string, and determining the position of the data to be queried in the ordered queue according to the character user identifier.
In an example embodiment of the present disclosure, after obtaining a character string corresponding to a user identifier according to a one-to-one mapping relationship between the user identifier and the character string, a character user identifier may be determined according to the character string, and a position of data to be queried may be determined according to the character user identifier. Specifically, because the character string is converted from the set of additional elements corresponding to the user identifier, the character user identifier corresponding to a certain user identifier is unique, so that the character user identifier can be determined according to the character string, after the character user identifier is determined, the position of the character user identifier in the ordered queue can be queried in the ordered queue, and the position of the data to be queried in the ordered queue can be determined accordingly.
Through the steps S1010 to S1030, when the position of the to-be-queried data corresponding to the user identifier in the ordered queue is determined through the user identifier, a one-to-one mapping relationship between the user identifier and the character string in the hash storage structure is obtained, the character string corresponding to the user identifier is obtained according to the one-to-one mapping relationship between the user identifier and the character string, the character user identifier is determined according to the character string, and the position of the to-be-queried data is determined in the ordered queue according to the character user identifier.
In an example embodiment of the disclosure, referring to fig. 11, when determining the position of the data to be queried in the ordered queue according to the user identifier P1, the character string v1 corresponding to the user identifier P1 may be searched according to the user identifier P1, the character user identifier v1_ P1 is determined according to v1, and then the position of the data to be queried is determined in the ordered base pair according to v1_ P1.
In an example embodiment of the present disclosure, in order to ensure that the position of the data to be queried corresponding to the user identifier in the ordered queue is determined by the user identifier, the ordered queue may be updated in real time or at regular time, for the ordered queue in which the fields of the plurality of elements are greater than the storage capacity, when updating, the element sequence and the hash storage structure need to be updated simultaneously, and when deleting a certain data in the ordered queue, the content related to the data in the hash storage structure also needs to be deleted simultaneously. Specifically, the lua script function is provided in the redis, so that the hash storage structure and the update element sequence can be ensured to be executed together, and the atomicity of the update operation is ensured.
In an example embodiment of the disclosure, a plurality of data and a plurality of elements corresponding to a user identifier and the user identifier in each data are acquired, the storage capacity of an element sequence is acquired, when fields of the plurality of elements are smaller than or equal to the storage capacity, the plurality of elements are stored in the element sequence, an ordered queue of the plurality of data is generated according to the user identifier and the element sequence, when the fields of the plurality of elements are larger than the storage capacity, a set of the elements smaller than the storage capacity is stored in the element sequence, a set of additional elements larger than the storage capacity is stored as a character string, the character string and the user identifier are integrated to obtain a character user identifier, and the ordered queue of the plurality of data is generated according to the character user identifier and the element sequence.
According to the embodiment of the disclosure, when the storage capacity of the element sequence is fixed, the additional elements larger than the element sequence are stored as the character strings, and the character strings and the user identifiers are integrated and sequenced to obtain the ordered queue. On one hand, when data are sequenced, more elements can be displayed in the ordered queue, and more information can be received according to data ranking, so that the problem of accepting or rejecting part of elements during data sequencing is avoided; on the other hand, the data can be sequenced according to a plurality of elements and character strings in the element sequence, and the problem that the data cannot be sequenced under the condition that one element is the same is avoided.
It is noted that the above-mentioned figures are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
In addition, in the exemplary embodiment of the present disclosure, a data processing apparatus is also provided. Referring to fig. 12, a data processing apparatus 1200 includes: a data acquisition module 1210, a first ordered queue generation module 1220, and a second ordered queue generation module 1230.
The data acquisition module is used for acquiring a plurality of data and a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of the element sequence; wherein the element sequence is used for storing the elements; the first ordered queue generating module is used for storing the elements in the element sequence when the fields of the elements are smaller than or equal to the storage capacity, and generating the ordered queues of the data according to the user identifiers and the element sequence; and the second ordered queue generating module is used for storing a set of elements smaller than the storage capacity into the element sequence when the fields of the elements are larger than the storage capacity, storing a set of additional elements larger than the storage capacity as character strings, integrating the character strings and the user identifiers to obtain character user identifications, and generating the ordered queues of the data according to the character user identifications and the element sequences.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, generating an ordered queue of a plurality of data according to a user identifier and an element sequence includes: generating a first storage queue according to the user identifier and the element sequence, and acquiring a first designated element in the plurality of elements; and sequencing the first storage queues according to the numerical value of the fields of the first designated elements in each first storage queue to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, generating an ordered queue of multiple data according to a character user identifier and an element sequence includes: generating a second storage queue according to the character user identification and the element sequence, and acquiring a first designated element in the plurality of elements; and sequencing the second storage queues according to the numerical value of the field of the first specified element in each second storage queue to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, when the number value of the field of the first specified element in the second storage queue is the same, the second storage queue is sorted according to the number value of the field of the second specified element; wherein the second specified element comprises one or more elements of the sequence of elements other than the first specified element.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, when the numerical values of the fields of the corresponding elements in each element sequence are the same, the second storage queue is sorted according to the character user identifier to generate the ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, the sorting the second storage queue according to the character user identifier to generate an ordered queue includes: analyzing the character user identifier to obtain a user identifier and a set of additional elements corresponding to the user identifier; and sequencing the second storage queue according to the magnitude relation of the numerical values of the fields of the additional elements in the set of the additional elements to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, sorting the second storage queue according to the numerical size of the field of the first specified element to generate an ordered queue includes: determining the magnitude relation of the numerical values of the fields of the first specified elements in each second storage queue; and sequencing the second storage queue according to the sequence from large to small to generate an ordered queue.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, a user identifier of a character string corresponding to the character string is obtained; and storing the character strings and the user identifiers corresponding to the character strings as a hash storage structure.
In an exemplary embodiment of the present disclosure, based on the foregoing scheme, when determining, by a user identifier, a position of data to be queried corresponding to the user identifier in an ordered queue, a one-to-one mapping relationship between the user identifier and a character string in a hash storage structure is obtained; acquiring a character string corresponding to the user identifier according to the one-to-one mapping relation of the user identifier and the character string; and determining a character user identifier according to the character string, and determining the position of the data to be queried in the ordered queue according to the character user identifier.
For details which are not disclosed in the embodiments of the apparatus of the present disclosure, please refer to the embodiments of the data processing method described above in the present disclosure for the details which are not disclosed in the embodiments of the apparatus of the present disclosure.
It should be noted that although in the above detailed description several modules or units of the device for action execution are mentioned, such a division is not mandatory. Indeed, the features and functionality of two or more modules or units described above may be embodied in one module or unit, according to embodiments of the present disclosure. Conversely, the features and functions of one module or unit described above may be further divided into embodiments by a plurality of modules or units.
In addition, in an exemplary embodiment of the present disclosure, an electronic device capable of implementing the data processing method is also provided.
As will be appreciated by one skilled in the art, aspects of the present disclosure may be embodied as a system, method or program product. Accordingly, various aspects of the disclosure may be embodied in the form of: an entirely hardware embodiment, an entirely software embodiment (including firmware, microcode, etc.) or an embodiment combining hardware and software aspects that may all generally be referred to herein as a "circuit," module "or" system.
An electronic device 1300 according to such an embodiment of the present disclosure is described below with reference to fig. 13. The electronic device 1300 shown in fig. 13 is only an example and should not bring any limitations to the function and scope of use of the embodiments of the present disclosure.
As shown in fig. 13, electronic device 1300 takes the form of a general-purpose computing device. The components of the electronic device 1300 may include, but are not limited to: the at least one processing unit 1310, the at least one memory unit 1320, the bus 1330 connecting the various system components (including the memory unit 1320 and the processing unit 1310), the display unit 1340.
Where the memory unit stores program code, the program code may be executed by the processing unit 1310 to cause the processing unit 1310 to perform steps according to various exemplary embodiments of the present disclosure as described in the "exemplary methods" section above in this specification. For example, the processing unit 1310 may execute step S210 shown in fig. 2, obtain a plurality of data and a plurality of elements corresponding to the user identifier and the user identifier in each data, and obtain the storage capacity of the element sequence; wherein the element sequence is used for storing the elements; step S220, when the fields of the elements are smaller than or equal to the storage capacity, storing the elements in an element sequence, and generating an ordered queue of a plurality of data according to the user identifier and the element sequence; step S230, when the fields of the multiple elements are greater than the storage capacity, storing the set of elements smaller than the storage capacity into the element sequence, storing the set of additional elements greater than the storage capacity as a character string, integrating the character string and the user identifier to obtain a character user identifier, and generating an ordered queue of multiple data according to the character user identifier and the element sequence.
As another example, the electronic device may implement the various steps shown in FIG. 2.
The storage 1320 may include readable media in the form of volatile memory units, such as a random access memory unit (RAM)1321 and/or a cache memory unit 1322, and may further include a read only memory unit (ROM) 1323.
Storage 1320 may also include a program/utility 1324 having a set (at least one) of program modules 1325, such program modules 1325 including, but not limited to: an operating system, one or more application programs, other program modules, and program data, each of which, or some combination thereof, may comprise an implementation of a network environment.
Bus 1330 may be any bus representing one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
The electronic device 1300 may also communicate with one or more external devices 1370 (e.g., keyboard, pointing device, bluetooth device, etc.), with one or more devices that enable a user to interact with the electronic device 1300, and/or with any devices (e.g., router, modem, etc.) that enable the electronic device 1300 to communicate with one or more other computing devices. Such communication may occur via input/output (I/O) interfaces 1350. Also, the electronic device 1300 may communicate with one or more networks (e.g., a Local Area Network (LAN), a Wide Area Network (WAN), and/or a public network, such as the internet) through the network adapter 1360. As shown, the network adapter 1360 communicates with other modules of the electronic device 1300 via the bus 1330. It should be appreciated that although not shown in the figures, other hardware and/or software modules may be used in conjunction with the electronic device 1300, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems, among others.
Through the above description of the embodiments, those skilled in the art will readily understand that the exemplary embodiments described herein may be implemented by software, or by software in combination with necessary hardware. Therefore, the technical solution according to the embodiments of the present disclosure may be embodied in the form of a software product, which may be stored in a non-volatile storage medium (which may be a CD-ROM, a usb disk, a removable hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which may be a personal computer, a server, a terminal device, or a network device, etc.) to execute the method according to the embodiments of the present disclosure.
In an exemplary embodiment of the present disclosure, there is also provided a computer-readable storage medium having stored thereon a program product capable of implementing the above-described method of the present specification. In some possible embodiments, various aspects of the disclosure may also be implemented in the form of a program product comprising program code for causing a terminal device to perform the steps according to various exemplary embodiments of the disclosure described in the above-mentioned "exemplary methods" section of this specification, when the program product is run on the terminal device.
A computer readable signal medium may include a propagated data signal with 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 readable signal medium may also be any readable medium that is not a 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 readable medium may be transmitted using any appropriate medium, including but not limited to wireless, wireline, optical fiber cable, RF, etc., or any suitable combination of the foregoing.
Program code for carrying out operations for the present disclosure may be written in any combination of one or more programming languages, including an object oriented programming language such as Java, C + + or the like 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 computing device, partly on the user's device, as a stand-alone software package, partly on the user's computing device and partly on a remote computing device, or entirely on the remote computing device or server. In the case of a remote computing device, the remote computing device may be connected to the user computing device through any kind of network, including a Local Area Network (LAN) or a Wide Area Network (WAN), or may be connected to an external computing device (e.g., through the internet using an internet service provider).
Furthermore, the above-described drawings are merely schematic illustrations of processes involved in methods according to exemplary embodiments of the present disclosure, and are not intended to be limiting. It will be readily understood that the processes shown in the above figures are not intended to indicate or limit the chronological order of the processes. In addition, it is also readily understood that these processes may be performed synchronously or asynchronously, e.g., in multiple modules.
Other embodiments of the disclosure will be apparent to those skilled in the art from consideration of the specification and practice of the disclosure disclosed herein. This application is intended to cover any variations, uses, or adaptations of the disclosure following, in general, the principles of the disclosure and including such departures from the present disclosure as come within known or customary practice within the art to which the disclosure pertains. It is intended that the specification and examples be considered as exemplary only, with a true scope and spirit of the disclosure being indicated by the following claims.

Claims (12)

1. A data processing method, comprising:
acquiring a plurality of data, a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of an element sequence; wherein the sequence of elements is used to store the elements;
when the fields of the plurality of elements are less than or equal to the storage capacity, storing the plurality of elements in an element sequence, and generating an ordered queue of the plurality of data according to the user identifier and the element sequence;
when the fields of the elements are larger than the storage capacity, storing a set of the elements smaller than the storage capacity into the element sequence, storing a set of additional elements larger than the storage capacity as character strings, integrating the character strings and the user identifiers to obtain character user identifications, and generating the ordered queue of the data according to the character user identifications and the element sequence.
2. The method of claim 1, wherein generating the ordered queue of the plurality of data from the user identifier and the sequence of elements comprises:
generating a first storage queue according to the user identifier and the element sequence, and acquiring a first designated element in the plurality of elements;
and sequencing the first storage queues according to the numerical values of the fields of the first designated elements in the first storage queues to generate ordered queues.
3. The method of claim 1, wherein generating the ordered queue of the plurality of data based on the character user identification and the sequence of elements comprises:
generating a second storage queue according to the character user identification and the element sequence, and acquiring a first designated element in the plurality of elements;
and sequencing the second storage queues according to the numerical value of the fields of the first designated elements in the second storage queues to generate ordered queues.
4. The method of claim 3, further comprising:
when the numerical values of the fields of the first specified elements in the second storage queue are the same, sorting the second storage queue according to the numerical value of the fields of the second specified elements;
wherein the second specified element comprises one or more elements of the sequence of elements other than the first specified element.
5. The method of claim 4, further comprising:
and when the numerical values of the fields of the corresponding elements in each element sequence are the same, sequencing the second storage queue according to the character user identification to generate an ordered queue.
6. The method of claim 5, wherein the sorting the second storage queue according to the character user identifier to generate an ordered queue comprises:
analyzing the character user identifier to obtain a user identifier and a set of additional elements corresponding to the user identifier;
and sequencing the second storage queue according to the magnitude relation of the numerical values of the fields of the additional elements in the set of the additional elements to generate an ordered queue.
7. The method of claim 3, wherein sorting the second store queue according to the numeric size of the field of the first specified element generates an ordered queue comprising:
determining the magnitude relation of the numerical values of the fields of the first specified elements in each second storage queue;
and sequencing the second storage queue according to the sequence from large to small to generate an ordered queue.
8. The method of claim 1, further comprising:
acquiring the character string and a user identifier corresponding to the character string;
and storing the character strings and the user identifiers corresponding to the character strings as a hash storage structure.
9. The method of claim 8, further comprising:
when the position of the data to be queried corresponding to the user identifier in the ordered queue is determined through the user identifier, acquiring a one-to-one mapping relation between the user identifier and the character string in the hash storage structure;
acquiring a character string corresponding to the user identifier according to the one-to-one mapping relation of the user identifier and the character string;
and determining the character user identification according to the character string, and determining the position of the data to be queried in the ordered queue according to the character user identification.
10. A data processing apparatus, characterized in that the apparatus comprises:
the data acquisition module is used for acquiring a plurality of data, a user identifier in each data and a plurality of elements corresponding to the user identifier, and acquiring the storage capacity of an element sequence; wherein the sequence of elements is used to store the elements;
a first ordered queue generating module, configured to store the plurality of elements in an element sequence when a field of the plurality of elements is less than or equal to the storage capacity, and generate an ordered queue of the plurality of data according to the user identifier and the element sequence;
and the second ordered queue generating module is used for storing a set of elements smaller than the storage capacity into the element sequence when the fields of the elements are larger than the storage capacity, storing a set of additional elements larger than the storage capacity into a character string, integrating the character string and the user identifier to obtain a character user identifier, and generating the ordered queue of the data according to the character user identifier and the element sequence.
11. A computer-readable storage medium, on which a computer program is stored, which program, when being executed by a processor, carries out the method according to any one of claims 1 to 9.
12. An electronic device, comprising:
a processor; and
memory for storing one or more programs which, when executed by the one or more processors, cause the one or more processors to implement the method of any of claims 1-9.
CN202110529849.8A 2021-05-14 2021-05-14 Data processing method, device, medium and electronic equipment Active CN113158096B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110529849.8A CN113158096B (en) 2021-05-14 2021-05-14 Data processing method, device, medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110529849.8A CN113158096B (en) 2021-05-14 2021-05-14 Data processing method, device, medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN113158096A CN113158096A (en) 2021-07-23
CN113158096B true CN113158096B (en) 2022-05-31

Family

ID=76876082

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110529849.8A Active CN113158096B (en) 2021-05-14 2021-05-14 Data processing method, device, medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN113158096B (en)

Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN109766497A (en) * 2019-01-22 2019-05-17 网易(杭州)网络有限公司 Ranking list generation method and device, storage medium, electronic equipment
CN110874360A (en) * 2018-09-04 2020-03-10 北京奇虎科技有限公司 Ordered queue caching method and device based on fixed capacity
CN112015732A (en) * 2020-07-31 2020-12-01 北京奇艺世纪科技有限公司 Sorting method, sorting device, electronic equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US20180081629A1 (en) * 2016-09-16 2018-03-22 Sevone, Inc. Method and apparatus for providing ordered sets of arbitrary percentile estimates for varying timespans
US11507555B2 (en) * 2019-10-13 2022-11-22 Thoughtspot, Inc. Multi-layered key-value storage

Patent Citations (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN110874360A (en) * 2018-09-04 2020-03-10 北京奇虎科技有限公司 Ordered queue caching method and device based on fixed capacity
CN109766497A (en) * 2019-01-22 2019-05-17 网易(杭州)网络有限公司 Ranking list generation method and device, storage medium, electronic equipment
CN112015732A (en) * 2020-07-31 2020-12-01 北京奇艺世纪科技有限公司 Sorting method, sorting device, electronic equipment and storage medium

Non-Patent Citations (1)

* Cited by examiner, † Cited by third party
Title
面向大数据的内存计算技术研究;张伟;《舰船电子工程》;20180320(第03期);全文 *

Also Published As

Publication number Publication date
CN113158096A (en) 2021-07-23

Similar Documents

Publication Publication Date Title
JP7000341B2 (en) Machine learning-based web interface generation and testing system
CN106943747B (en) Virtual role name recommendation method and device, electronic equipment and storage medium
CN109324861B (en) Message display processing method, device, medium and electronic equipment
US9652528B2 (en) Prompting subject matter experts for additional detail based on historical answer ratings
CN110833696A (en) Player ranking method and device, storage medium and electronic equipment
CN110727782A (en) Question and answer corpus generation method and system
CN110059172B (en) Method and device for recommending answers based on natural language understanding
CN111179007A (en) Display information processing method and device and electronic equipment
CN113158096B (en) Data processing method, device, medium and electronic equipment
CN112989174A (en) Information recommendation method and device, medium and equipment
CN111905375B (en) Display method, device and related equipment
US20210357955A1 (en) User search category predictor
US11007443B2 (en) Method for performing game by using activity count
CN112308016A (en) Expression image acquisition method and device, electronic equipment and storage medium
CN112348614A (en) Method and device for pushing information
US20220350652A1 (en) Service design device, service design method, and non-transitory computer-readable storage medium for storing service design program
CN113595999B (en) User equipment authentication method and device based on one-way feature screening and electronic equipment
US20240152933A1 (en) Automatic mapping of a question or compliance controls associated with a compliance standard to compliance controls associated with another compliance standard
US20240028309A1 (en) System and method for generating package for a low-code application builder
CN116541002A (en) Search page generation method and device, storage medium and terminal equipment
CN117215457A (en) Data processing method, apparatus, computer device, storage medium, and program product
CN115905690A (en) Resource recommendation method and device, electronic equipment and storage medium
CN112507100A (en) Method and device for updating question-answering system
CN113641697A (en) Crowd generation method and device, electronic equipment and storage medium
CN115858346A (en) Data generation method and device

Legal Events

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