CN110795632B - State query method and device and electronic equipment - Google Patents

State query method and device and electronic equipment Download PDF

Info

Publication number
CN110795632B
CN110795632B CN201911046577.5A CN201911046577A CN110795632B CN 110795632 B CN110795632 B CN 110795632B CN 201911046577 A CN201911046577 A CN 201911046577A CN 110795632 B CN110795632 B CN 110795632B
Authority
CN
China
Prior art keywords
queried
cache
information
identification information
pairing
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
CN201911046577.5A
Other languages
Chinese (zh)
Other versions
CN110795632A (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.)
Beijing Dajia Internet Information Technology Co Ltd
Original Assignee
Beijing Dajia Internet Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Dajia Internet Information Technology Co Ltd filed Critical Beijing Dajia Internet Information Technology Co Ltd
Priority to CN201911046577.5A priority Critical patent/CN110795632B/en
Publication of CN110795632A publication Critical patent/CN110795632A/en
Application granted granted Critical
Publication of CN110795632B publication Critical patent/CN110795632B/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/953Querying, e.g. by the use of web search engines
    • G06F16/9535Search customisation based on user profiles and personalisation
    • 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/953Querying, e.g. by the use of web search engines
    • G06F16/9537Spatial or temporal dependent retrieval, e.g. spatiotemporal queries

Abstract

The disclosure relates to a state query method, a state query device and electronic equipment, which are used for querying the state of an object. When the state query is needed, the method and the device respond to the state query instruction, and obtain the identification information of the object to be queried from the state query instruction; if the matching information of the objects to be queried is determined to be contained in the plurality of cache regions according to the identification information of the objects to be queried, determining the state of the objects to be queried as the state to be matched after matching is applied; the cache areas are used for storing pairing information of objects applying for matching. The state query method provided by the embodiment of the disclosure determines the state of an object to be queried by querying the identification information of the object to be queried in a plurality of cache regions; the problem of slow response of the cache region when the request for accessing the single cache region is excessive is avoided; the state of the object to be queried is determined in the cache regions, and the efficiency of querying the state of the object to be queried is improved.

Description

State query method and device and electronic equipment
Technical Field
The present disclosure relates to the field of computer technologies, and in particular, to a method and an apparatus for querying a status, and an electronic device.
Background
With the rapid development of internet multimedia technology, live webcasting is increasingly becoming the key application mode of the internet. Through network live broadcast, the method can quickly and effectively transmit information, has the characteristics of site type, real-time property, intuition, entertainment and the like, and accords with the interest of people in the Internet era.
In order to enhance the interest, the business of the live broadcast room is more and more. The current network live broadcast technology not only supports a live broadcast object to live broadcast of audiences in a live broadcast room of the current network live broadcast technology in a live broadcast form. With the development of live broadcast technology, a form of making two live broadcast objects together and making the picture and sound simultaneously face the audience of both live broadcast rooms to carry out live broadcast also appears. In order to improve the interest of live broadcast to a greater extent, a competitive PK mechanism is introduced, and live broadcast objects of two parties are subjected to a short competition, which is also called live broadcast PK.
In the matching mode of live PK, the way of assigning PK objects to the objects applying PK in the matching mode is: storing the pairing information of the objects applying for PK in a matching mode in a cache region, and allocating PK objects to the objects to be paired according to the pairing information of the objects in the cache region. However, due to the mutual exclusivity of the live broadcasting service, in some service situations, it is necessary to query whether the object applies for the matching PK, for example, when a friend is invited to perform PK in an invitation mode, it is necessary to query whether the friend applies for the matching PK. But at present, no object state query scheme exists.
Disclosure of Invention
The disclosure provides a state query method, a state query device and electronic equipment, which are used for querying a state of an object. The technical scheme of the disclosure is as follows:
according to a first aspect of the embodiments of the present disclosure, there is provided a status query method, including:
responding to a state query instruction, and acquiring identification information of an object to be queried from the state query instruction;
if the plurality of cache regions contain the pairing information of the objects to be queried according to the identification information of the objects to be queried, determining the state of the objects to be queried as the state to be matched after application for matching; the cache regions are used for storing pairing information of objects applying for matching.
In a possible implementation manner, the determining, according to the identification information of the object to be queried, that the multiple cache regions include pairing information of the object to be queried includes:
determining a cache region corresponding to the identification information of the object to be queried;
and if the determined cache regions contain the pairing information of the objects to be inquired, determining that the plurality of cache regions contain the pairing information of the objects to be inquired.
In a possible implementation manner, the determining a cache region corresponding to the identification information of the object to be queried includes:
determining a hash value obtained by performing hash operation on the identification information of the object to be inquired, and performing modular operation on the determined hash value and the number of cache areas;
and taking the cache region with the same number as the modular operation result as the cache region corresponding to the identification information of the object to be inquired.
In one possible implementation, before responding to the status query instruction, the method further includes:
after the object applies for matching, selecting a cache region for storing the pairing information of the object from a plurality of cache regions according to the identification information of the object;
and storing the pairing information of the object to the selected cache region through a processing thread corresponding to the selected cache region.
In a possible implementation manner, the selecting, from a plurality of buffers, a buffer for storing pairing information of the object according to the identification information of the object includes:
determining a hash value obtained by performing hash operation on the identification information of the object, and performing modular operation on the determined hash value and the number of cache areas;
and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object.
In a possible implementation manner, the determining, according to the identification information of the object to be queried, that the plurality of cache regions include pairing information of the object to be queried includes:
if the pre-stored identification set contains the identification information of the object to be queried, determining that a plurality of cache regions contain pairing information of the object to be queried; and the identification set comprises identification information of the object applying for matching.
According to a second aspect of the embodiments of the present disclosure, there is provided a status query apparatus, including:
the acquisition module is configured to execute a response state query instruction and acquire identification information of an object to be queried from the state query instruction;
the determining module is configured to determine that the state of the object to be queried is a state to be matched after applying for matching if the determining module determines that the plurality of cache regions comprise pairing information of the object to be queried according to the identification information of the object to be queried; the cache areas are used for storing pairing information of objects applying for matching;
in a possible implementation manner, the determining module is configured to perform determining a cache region corresponding to the identification information of the object to be queried; and if the determined cache regions contain the pairing information of the objects to be inquired, determining that the plurality of cache regions contain the pairing information of the objects to be inquired.
In a possible implementation manner, the determining module is configured to perform hash value determination for performing hash operation on the identification information of the object to be queried, and perform modulo operation on the determined hash value and the number of cache regions; and taking the cache region with the same number as the modulo operation result as the cache region corresponding to the identification information of the object to be inquired.
In one possible implementation, the apparatus further includes: the storage module is configured to select a cache region for storing the pairing information of the object from a plurality of cache regions according to the identification information of the object after the object applies for matching; and storing the pairing information of the object to the selected cache region through a processing thread corresponding to the selected cache region.
In a possible implementation manner, the storage module is configured to determine a hash value obtained by performing a hash operation on the identification information of the object, and perform a modulo operation on the determined hash value and the number of cache areas; and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object.
In a possible implementation manner, the determining module is configured to determine that the plurality of cache regions include the pairing information of the object to be queried if it is determined that the pre-stored identification set includes the identification information of the object to be queried; and the identification set comprises identification information of the object applying for matching.
In a possible implementation manner, the determining module is configured to determine that the plurality of cache regions include the pairing information of the object to be queried if a pre-stored correspondence between the identification information and the state information of the object includes state information corresponding to the identification information of the object to be queried.
According to a third aspect of an embodiment of the present disclosure, there is provided an electronic apparatus including: a memory for storing executable instructions;
a processor configured to read and execute the executable instructions stored in the memory to implement the status query method according to any one of the first aspect of the embodiments of the disclosure.
According to a fourth aspect of the embodiments of the present disclosure, there is provided a non-volatile storage medium, where instructions that, when executed by a processor of a status-querying electronic device, enable the status-querying electronic device to perform the status-querying method described in the first aspect of the embodiments of the present disclosure.
The technical scheme provided by the embodiment of the disclosure at least brings the following beneficial effects:
according to the embodiment of the invention, the pairing information of the objects to be paired is read through the plurality of processing threads corresponding to the plurality of cache regions, and when the objects to be paired are too many, the plurality of processing threads read the pairing information of the objects to be paired in parallel, so that the time for reading the pairing information by a single processing thread can be shortened, the response speed is accelerated, and the execution efficiency of the task for pairing the objects to be paired can be effectively improved.
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 and are not to be construed as limiting the disclosure.
FIG. 1 is a flow diagram illustrating a method of status querying in accordance with an exemplary embodiment;
FIG. 2 is a schematic diagram illustrating a plurality of cache regions in accordance with an illustrative embodiment;
FIG. 3 is a full flow diagram illustrating a method for providing a pairing set for a subject applying for a PK in the invite PK mode in accordance with an exemplary embodiment;
FIG. 4 is a full flow diagram illustrating another method for providing a pairing set for a subject applying for a PK in the invite PK mode in accordance with an exemplary embodiment;
FIG. 5 is a full flowchart illustrating another method for providing a pairing set for a subject applying for a PK in the INVITE PK mode in accordance with one exemplary embodiment;
FIG. 6 is a schematic diagram illustrating a plurality of buffers in accordance with an illustrative embodiment;
FIG. 7 is a complete flow diagram illustrating a matching method in accordance with an exemplary embodiment;
FIG. 8 is an interaction flow diagram illustrating a matching method in accordance with an exemplary embodiment;
FIG. 9 is a block diagram illustrating a state querying device, according to an example embodiment;
FIG. 10 is a block diagram illustrating an electronic device in accordance with an example embodiment.
Detailed Description
In order to make the technical solutions of the present disclosure better understood by those of ordinary skill in the art, the technical solutions in the embodiments of the present disclosure will be clearly and completely described below with reference to the accompanying drawings.
It should be noted that the terms "first," "second," and the like in the description and claims of the present disclosure and in the above-described drawings are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the disclosure described herein are capable of operation in other sequences than those illustrated or described herein. The implementations described in the exemplary embodiments below do not represent all implementations consistent with the present disclosure. Rather, they are merely examples of apparatus and methods consistent with certain aspects of the disclosure, as detailed in the appended claims.
Hereinafter, some terms in the embodiments of the present disclosure are explained to facilitate understanding by those skilled in the art.
(1) The term "plurality" in the embodiments of the present disclosure means two or more, and other terms are similar thereto.
(2) The term "Hash" is generally translated as a Hash, or transliteration as a Hash, and refers to the conversion of an input of arbitrary length (also called a pre-mapped pre-image) into an output of fixed length by a hashing algorithm, where the output is a Hash value. This transformation is a kind of compression mapping, i.e. the space of hash values is usually much smaller than the space of inputs, different inputs may hash to the same output, so it is not possible to determine a unique input value from a hash value. In short, it is a function of compressing a message of an arbitrary length to a message digest of a certain fixed length.
(3) The term "modulo operation" in the embodiments of the present disclosure means that given a positive integer p, any integer n, there must be an equation: n = kp + r; wherein k and r are integers, and r is more than or equal to 0 and less than p, the quotient of n divided by p is called as k, and r is the remainder of n divided by p.
For positive integer p and integers a, b, the modulo operation is defined as: a% p (or amodp), representing the remainder of a divided by p.
(4) The term "processing thread" in the embodiments of the present disclosure refers to the smallest unit that an operating system can perform operation scheduling. It is included in the process and is the actual unit of operation in the process. A thread refers to a single sequential control flow in a process, multiple threads can be concurrently executed in a process, and each thread executes different tasks in parallel.
Currently, there are two types of PK patterns in the live broadcast, one is the matching PK pattern and the other is the invitation PK pattern. In the PK matching mode, when an object applying for pairing initiates a pairing request at a client, a server responds and stores pairing information of the object applying for pairing in a cache region of a redis database. When the objects are paired, the pairing information of the objects is read from the buffer area, and the objects are paired according to the pairing information. However, due to mutual exclusivity of services in the live broadcast room, when an object applies for a matching PK, other services cannot be performed, for example, the object applying for the matching PK is not allowed to appear in a buddy list in an invitation PK mode, a live broadcast connection is not allowed to be initiated, a voice chat room is not allowed to be created, and in these service cases, it is necessary to query whether the object applies for the matching PK, that is, it is necessary to query whether the state of the object in a cache area is a to-be-matched state after applying for matching.
Taking the invitation PK mode as an example, in the invitation PK mode, the object may invite the online live broadcast object in the buddy list to perform live broadcast PK. However, since the matching PK mode and the inviting PK mode belong to different live PK services, if the friend has initiated a matching request in the matching PK mode, the subject cannot invite the friend to live PK in the inviting PK mode. Therefore, when a PK object is allocated to an object in the invitation PK mode, the state of the added buddy needs to be queried, whether the added buddy initiates a matching request in the matching PK mode is determined, and the object which is live online and does not initiate a matching request in the matching PK mode in the buddy list is taken as an inviteable object of the object.
However, the pairing information of the object applying for matching in the matching PK mode is stored in a cache region of the redis database, and when determining the inviteable object of the object in the invitation PK mode, it needs to be determined whether the object in the buddy list initiates the matching request in the matching PK mode, that is, it needs to query whether the state of the buddy is the to-be-matched state after applying for matching in the cache region, and if it is determined that the pairing information of the buddy is stored in the cache region, the buddy may not be the inviteable object. When the state of a friend is queried, because the server side of the redis database is a single-thread model, if too many requests for accessing the cache region result in too slow query response, the efficiency for determining the state of the friend is low, and the efficiency for determining an inviteable object of an object to be matched is too low.
The state query method disclosed by the embodiment of the disclosure avoids too slow query response and too low efficiency of querying the state of an object caused by too large data amount of a cache region and too many requests for accessing the cache region. The state of the object to be inquired is determined by determining the pairing information of the object to be inquired from the plurality of cache regions, so that the efficiency of inquiring the state of the object to be inquired is improved.
To make the objects, technical solutions and advantages of the present disclosure clearer, the present disclosure will be described in further detail with reference to the accompanying drawings, and it is apparent that the described embodiments are only a part of the embodiments of the present disclosure, rather than all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments disclosed herein without making any creative effort, shall fall within the protection scope of the present disclosure.
Embodiments of the present disclosure are described in further detail below.
FIG. 1 is a flow chart illustrating a status query method according to an exemplary embodiment, as shown in FIG. 1, including the steps of:
in step S101, in response to a status query instruction, obtaining identification information of an object to be queried from the status query instruction;
in step S102, if it is determined that the plurality of cache regions include pairing information of the object to be queried according to the identification information of the object to be queried, it is determined that the state of the object to be queried is a state to be matched after applying for matching.
The cache regions are used for storing pairing information of objects applying for matching.
As can be seen from the above, in the embodiment of the present disclosure, when the state of the object to be queried is queried, the identification information of the object to be queried is obtained, the matching information of the object to be queried is queried in the multiple cache regions according to the identification information of the object to be queried, and if the matching information of the object to be queried is queried in the multiple cache regions, the state of the object to be queried is determined as the state to be matched after applying for matching; and if the pairing information of the objects to be inquired is not inquired in the plurality of cache areas, determining that the state of the objects to be inquired is not the state to be matched. The method comprises the steps that identification information of an object to be queried is queried in a plurality of cache regions, and the state of the object to be queried is determined; the problem of slow response of the cache region when the requests for accessing the single cache region are too many is avoided; the state of the object to be queried is determined in the cache regions, and the efficiency of querying the state of the object to be queried is improved.
It should be noted that, in the embodiment of the present disclosure, there is no limitation on the specific number of the cache regions for storing the pairing information of the object applying for matching, and the number of the cache regions may be a value preset by a person skilled in the art. For example, the pairing information of the object to be matched is stored in 10 cache regions, and when the pairing information of the object to be queried is queried in the 10 cache regions, the pairing information of the object to be matched in the 10 cache regions is read in parallel through the processing threads corresponding to the 10 cache regions.
FIG. 2 is a schematic diagram illustrating multiple buffers, where different buffers correspond to different processing threads, in accordance with an illustrative embodiment. As shown in fig. 2, it is assumed that pairing information of an object to be matched is stored in 10 cache regions, each cache region has a number, each cache region corresponds to one processing thread, and the numbers of the 10 cache regions are 0 to 9 respectively and correspond to the processing threads T0 to T9 respectively.
Before responding to the status query instruction, when an object applies for pairing, pairing information of the object applying for matching can be stored in a plurality of cache regions.
The pairing information of the object applying for matching in the embodiment of the present disclosure includes, but is not limited to:
applying for identification information, pairing types and application time of matched objects to be matched;
it should be noted that, because there are many specific information included in the pairing information of the objects to be matched, they cannot be listed one by one; the information included in the pairing information of the object to be matched is exemplary, and does not limit the protection scope of the embodiment of the present disclosure. The following describes information included in the pairing information:
1. the identification information of the object to be matched may be an ID (Identity) of the object to be matched. For example, the ID of the object to be matched in the embodiment of the present disclosure may be a mobile phone number used in registration.
2. The matching type of the object to be matched is a type option selected by the object to be matched when the object to be matched applies for matching, and is a main basis for matching the object to be matched. For example, the pairing type can be "city together," "talent," "game," etc.;
assuming that the type option selected by the object to be matched in the application for matching is "talent art", when matching the object to be matched, preferentially allocating the object to be matched with the same matching type, that is, preferentially allocating the object to be matched with the same choice "talent art".
3. The application time of the object to be matched is the application matching time of the object to be matched;
optionally, when the application time of the object to be matched is too early, but the object to be matched is not paired, which indicates that there is no suitable paired object in a period of time, the server may remove the pairing information of the object to be matched from the cache area.
In implementation, when the pairing information of the object applying for matching is stored in the plurality of cache areas, the pairing information of the object applying for matching may be stored in the plurality of cache areas according to the identification information.
It should be noted that the subject applying for matching in the embodiment of the present disclosure may be a subject applying for pairing in a matching PK pattern.
An optional implementation manner is that the pairing information of the object applying for matching is stored in a plurality of cache regions according to the following manner:
after the object applies for matching, selecting a cache region for storing the pairing information of the object from the plurality of cache regions according to the identification information of the object; and storing the pairing information of the object to the selected cache region through the processing thread corresponding to the selected cache region.
In implementation, according to the embodiment of the present disclosure, a cache region for storing the pairing information of the object needs to be selected from the plurality of cache regions according to the identification information of the object, and then the pairing information of the object needs to be stored in the selected cache region through a processing thread corresponding to the selected cache region. For example, the cache area for storing the pairing information of the object selected according to the identification information of the object is the cache area with the number of 0, and then the pairing information of the object is stored to the cache area with the number of 0 by the processing thread T0 corresponding to the cache area with the number of 0.
A method for selecting a cache area for storing pairing information of an object from a plurality of cache areas according to identification information of the object is described in detail as follows:
in implementation, determining a hash value obtained by performing hash operation on identification information of an object, and performing modulo operation on the determined hash value and the number of cache areas; and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object.
Specifically, a hash value obtained by performing hash operation on the identification information of the object is determined, after the hash value corresponding to the identification information of the object is obtained, a modulo operation is performed on the hash value and the number of cache areas, and the cache area storing the pairing information of the object can be selected according to a result of the modulo operation.
For example, the identification information of the object is an ID of the object, and specifically may be a mobile phone number used when the object is registered. Assume that the identification information of the object is 1436852XXXX;
the hash operation is performed on the identification information of the object to obtain a hash value, and it is assumed that the hash value obtained by the identification information of the object is 25.
It should be noted that the number of the cache regions, the identification information of the object to be matched, and the hash value corresponding to the identification information obtained through the hash operation in the embodiment of the present disclosure are only examples, and are only used to illustrate the method for selecting the cache region storing the pairing information of the object to be matched according to the identification information of the object to be matched provided in the embodiment of the present disclosure. The hash value corresponding to the identification information obtained by the hash operation may be obtained by using a manner in the prior art, which is not described in detail herein.
Performing modular operation on the determined hash values and the number of the cache regions, assuming that the number of the cache regions is 10, performing modular operation: 25% by weight, 10=5.
And selecting the cache region with the same number as the modulo operation result as the cache region for storing the object pairing information. That is, the number of the 10 buffers is from 0 to 9, and the buffer with the number 5 is used as the buffer storing the pairing information of the object to be matched with the identification information of 1436852 XXXX.
After a cache region used for storing the pairing information of the objects to be matched is selected, the pairing information of the objects to be matched is stored in the cache region through the thread corresponding to the selected cache region. Specifically, the thread T5 corresponding to the cache region with the number of 5 stores the pairing information of the object to be matched, of which the identification information is 1436852XXXX, into the cache region.
When there are many objects to be matched, hash values obtained by hashing identification information of the objects to be matched through hash operation are many and random, assuming that the number of the cache regions is 10, and a result obtained by performing modulo operation on the obtained hash values and the number of the cache regions may be any number from 0 to 9, then:
storing the pairing information of the object to be matched with the modulus operation result of 0 into a cache region with the number of 0 through a processing thread T0;
storing the pairing information of the object to be matched with the modular operation result of 1 into a cache region with the number of 1 through a processing thread T1;
storing the pairing information of the object to be matched with the modular operation result of 2 into a cache region with the serial number of 2 through a processing thread T2;
storing the pairing information of the object to be matched with the modular arithmetic result of 3 into a cache region with the serial number of 3 through a processing thread T3;
storing the pairing information of the object to be matched with the modular operation result of 4 into a cache region with the serial number of 4 through a processing thread T4;
storing the pairing information of the object to be matched with the modular operation result of 5 into a cache region with the serial number of 5 through a processing thread T5;
storing the pairing information of the object to be matched with the modular operation result of 6 into a buffer area with the serial number of 6 through a processing thread T6;
storing the pairing information of the object to be matched with the modular operation result of 7 into a cache region with the serial number of 7 through a processing thread T7;
storing the pairing information of the object to be matched with the modular operation result of 8 into a cache region with the serial number of 8 through a processing thread T8;
and storing the pairing information of the object to be matched with the modular operation result of 9 into the buffer area with the number of 9 through the processing thread T9.
The method stores the pairing information of all objects applying for matching in the PK mode in a plurality of cache regions, and when determining whether a certain object applies for matching in the matched PK mode, namely determining whether the object is in a to-be-matched state, the method needs to determine whether the pairing information of the object is stored in the cache regions.
In implementation, a state query instruction is responded, and identification information of an object to be queried is obtained from the state query instruction; when the state of the object to be queried is queried, whether the pairing information of the object to be queried is contained in the plurality of cache regions is determined according to the identification information of the object to be queried, and if the pairing information of the object to be queried is stored in the plurality of cache regions, the state of the object to be queried is determined to be a state to be matched.
The embodiment of the disclosure provides a method for determining whether a plurality of cache regions contain pairing information of an object to be queried according to identification information of the object to be queried, comprising the following steps:
aiming at any one object to be queried, determining a cache region corresponding to the identification information of the object to be queried; and if the determined cache regions contain the pairing information of the objects to be inquired, determining that the plurality of cache regions contain the pairing information of the objects to be inquired.
In implementation, a cache region corresponding to the identification information of the object to be queried is determined, and the pairing information of the object to be queried is queried in the determined cache region; and if the pairing information of the object to be inquired is inquired in the determined cache regions, determining that the plurality of cache regions contain the pairing information of the object to be inquired.
Optionally, when the pairing information includes the identification information, and when the pairing information of the object to be queried is queried in the determined cache region, the identification information of the object to be queried may be searched in the determined cache region; and if the determined cache regions have the identification information of the object to be queried, determining that the plurality of cache regions have the pairing information of the object to be queried.
For example, the number of the plurality of cache regions is 10, the identification information of the object to be queried of the plurality of cache regions is 1436852XXXX, and if it is determined that the cache region corresponding to the identification information of the object to be queried is the cache region numbered 2, the identification information of the object to be queried is queried in the cache region numbered 2 by using the processing thread T2 corresponding to the cache region numbered 2, and if the cache region numbered 2 includes the pairing information of the object to be queried, and specifically includes the identification information 1436852XXXX of the object to be queried, it is determined that the 10 cache regions include the pairing information of the object to be queried.
An optional implementation manner is that the cache region corresponding to the identification information of the object to be queried is determined by the following manner:
determining a hash value obtained by performing hash operation on identification information of an object to be queried, and performing modular operation on the determined hash value and the number of cache areas; and taking the cache region with the same number as the modulo operation result as the cache region corresponding to the identification information of the object to be inquired.
Specifically, a hash value obtained by performing hash operation on the identification information of the object to be queried is determined, after the hash value corresponding to the identification information of the object to be queried is obtained, a modulo operation is performed on the hash value and the number of cache regions, and the cache region corresponding to the identification information of the object to be queried can be determined according to a result of the modulo operation.
If the object to be queried applies for pairing in the matched PK mode, the cache region for storing the pairing information of the object to be queried is selected according to the identification information of the object to be queried. Therefore, it is required to query whether the object to be queried has applied for pairing in the matching PK mode in a cache area where pairing information of the object to be queried may be stored. The matching information of the object to be queried does not need to be queried in each cache region, the query range is narrowed, the query speed is increased, and the speed of determining the state of the object to be queried is increased.
For example, the identification information of a certain object to be queried is an ID of the object to be queried, specifically, a mobile phone number used when the object to be queried is registered; the identification information of an object to be queried is assumed to be 1586412XXXX;
performing hash operation on the identification information of the object to be queried to obtain a hash value, and assuming that the hash value obtained by the identification information of the object to be queried is 62; the method for performing hash operation on the identification information of the object to be queried is the same as that in the prior art, and is not described herein again.
Carrying out modular operation on the determined hash values and the number of the cache regions, and carrying out modular operation on the cache regions if the number of the cache regions is 5: 62% by weight of 5=2.
And taking the cache region with the same number as the modulo operation result as the cache region corresponding to the identification information of the object to be inquired. That is, the number of the 5 cache regions is from 0 to 4, and the cache region with the number of 2 is used as the cache region corresponding to the identification information of the object to be queried.
The matching information of the object to be queried is queried in the cache region with the number of 2, and specifically, the identification information of the object to be queried may be queried. If the identification information 1586412XXXX of the object to be queried is queried in the cache region with the number of 2, determining that the 5 cache regions contain the pairing information of the object to be queried, and determining the state of the object to be queried and applying for a matched state to be matched; if the identification information 1586412XXXX of the object to be queried is not queried in the cache region with the number of 2, it is determined that no pairing information of the object to be queried exists in any of the 5 cache regions, and it is determined that the state of the object to be queried is an unapplied matching state.
In the following, the state query method provided in the embodiment of the present disclosure is described with the invite PK mode as an application scenario. In the invitation PK mode, a pairing set is provided for a PK applying object, the pairing set comprises a plurality of target objects, and the PK applying object can select one of the target objects to perform PK in the invitation PK mode.
When providing a pairing set for the object, the target object needs to satisfy the following condition:
1. the target object is a friend of the object applying PK;
2. the target object is an online object;
3. the target subject is not applying for PK in the matching PK pattern;
target objects meeting the above three conditions form a pairing set, where when determining whether the condition that "the target object is not matching with a PK mode application PK" is met, an optional implementation manner is the status query method provided in the embodiments of the present disclosure.
Fig. 3 is a flowchart illustrating a method for providing a pairing set for a PK applied for a subject in an invited PK mode, according to an exemplary embodiment, as shown in fig. 3, including the steps of:
in step S301, the object applies for matching to the API service node through the client;
in step S302, the API service node selects a cache area storing the pairing information of the object from the plurality of cache areas according to the identification information of the object, and stores the pairing information of the object in the selected cache area;
in step S303, the API service node determines that the pairing information is successfully stored;
in step S304, the API service node returns a waiting pairing response to the client;
step S301 to step S304 are processes of storing pairing information of the object applying for PK in the matching PK mode into a plurality of cache areas;
in step S305, the object sends a pairing set generation instruction to the API service node through the client;
in step S306, the API service node obtains a buddy list of the object from the user relationship service node;
in step S307, the user relationship service node returns the buddy list of the object;
in step S308, the API service node obtains identification information of an online object in a buddy list of the object from the online live broadcast service node;
at the moment, the online object is the object to be inquired;
in step S309, the online live broadcast service node returns the identification information of the online object in the buddy list of the object to the API service node;
in step S310, the API service node queries pairing information of online objects in the buddy list in multiple cache regions;
in step S311, the API service node obtains a query result whether the online object is in a plurality of cache regions;
in step S312, the API service node takes an online object that is not in the multiple cache areas as a target object, and adds identification information of the target object to the pairing set;
in step S313, the API service node returns the pairing set to the client.
Here, steps S305 to S313 are procedures for providing a pairing set for a subject who applies for a PK in the invite PK mode.
The embodiment of the disclosure further provides a method for determining whether the plurality of cache regions contain pairing information of the object to be queried according to the identification information of the object to be queried.
An optional implementation manner is that if it is determined that the pre-stored identification set contains identification information of an object to be queried, it is determined that pairing information of the object to be queried is contained in the plurality of cache regions; the identification set comprises identification information of an object applying for matching.
The embodiment of the disclosure determines whether the matching information of the object to be queried is stored in the plurality of cache regions by querying the identification information of the object to be queried in the identification set, thereby avoiding the problem of too slow query response caused by too much matching information in the cache regions and too many requests for accessing the cache regions to query the state of the object to be queried, and improving the efficiency of querying the state of the object to be queried.
Specifically, when pairing information of an object applying for matching PK is stored in a plurality of cache areas, identification information of the object applying for matching PK is stored in an identification set.
In an implementation, the identification set may be stored in a specific cache region, where identification information of the objects matching the PK pattern application is stored, wherein the cache region may store only one identification information of each object matching the PK pattern application, and the identification information may be an object ID.
For example, the matched objects are U1, U2, and U3 in the PK pattern matching application. Identification information of the object U1 is 1480000XXXX; identification information of the object U2 is 1452333XXXX; the identification information of the object U3 is 1892475XXXX. When the objects U1, U2 and U3 apply for matching in the matched PK mode, the identification set formed by the identification information of the objects U1, U2 and U3 is stored in a single cache region respectively. The contents stored in this buffer are "1480000XXXX", "1452333XXXX", "1892475XXXX".
When the state of the object to be queried needs to be determined, querying the identification information of the object to be queried in the identification set according to the identification information of the object to be queried; if the identification set contains identification information of the object to be queried, determining that the pairing information of the object to be queried is stored in a plurality of cache regions, namely the state of the object to be queried is the state to be matched after applying for matching.
The state query method provided by the embodiment of the present disclosure is described with the invitation PK mode as an application scenario. When a pairing set is provided for an object applying for PK in the invitation PK mode, a target object forming the pairing set needs to be determined, and at this time, an online object in the better list of the object applying for PK in the invitation PK mode is an object to be queried.
For example, the identification information of a certain online object is 1682468XXXX, when determining whether the online object can be used as a target object, by querying whether the identification information of "1682468XXXX" exists in the identification set, if the identification information exists in the identification set, the state of the online object is determined to be a to-be-matched state after matching is applied, and the online object cannot be used as the target object; if the identification information is not queried in the identification set, the online object can be used as a target object.
According to the method for determining whether the plurality of cache regions contain the pairing information of the objects to be queried, the embodiment of the disclosure further provides a state query method. May be applied in scenarios where a pairing set is provided for a subject applying for a PK in the invite PK mode.
Fig. 4 is a flowchart illustrating an overall process of another method for providing a pairing set for a PK applied for a subject in an invited PK mode, according to an exemplary embodiment, as shown in fig. 4, including the steps of:
in step S401, the object applies for matching to the API service node through the client;
in step S402, the API service node selects a cache area storing the pairing information of the object from the plurality of cache areas according to the identification information of the object, and stores the pairing information of the object in the selected cache area;
in step S403, the API service node determines that the pairing information is successfully stored;
in step S404, the API service node stores the identification information of the object in an identification set;
in step S405, the API service node determines that the storage of the identification information is successful;
in step S406, the API service node returns a waiting pairing response to the client;
the steps S401 to S406 are a process of storing the pairing information of the object applying for PK in the matching PK mode into a plurality of cache areas, and a process of pre-storing the identification information of the object applying for PK in the matching PK mode into an identification set;
in step S407, the object sends a pairing set generation instruction to the API service node through the client;
in step S408, the API service node obtains a buddy list of the object from the user relationship service node;
in step S409, the user relationship service node returns the buddy list of the object;
in step S410, the API service node obtains identification information of an online object in a buddy list of the object from the online live broadcast service node;
at the moment, the online object is the object to be inquired;
in step S411, the online live broadcast service node returns the identification information of the online object in the buddy list of the object to the API service node;
in step S412, the API service node queries, in the identification set, identification information of the online object in the buddy list;
in step S413, the API service node obtains a query result whether the online object is in the identification set;
in step S414, the API service node takes an online object that is not in the identification set as a target object, and adds identification information of the target object to the pairing set;
in step S415, the API service node returns the pairing set to the client.
It should be noted that, in the prior art, after an object applies for matching, pairing information of the object applying for matching is stored in a cache region, and on the basis of the prior art, the method for querying a state from a pre-stored representation set according to identification information of an object to be queried provided by the embodiment of the present disclosure may also be applied.
That is to say, the state query method provided by the embodiment of the present disclosure may be implemented specifically as follows:
after the objects apply for matching, the matching information of the objects applying for matching is stored in a buffer area, and the identification information of the objects applying for matching is stored in an identification set.
The identification set may be stored in a specific cache region, where identification information of the objects paired in the matching PK pattern application is stored, where the cache region may store only one identification information of each object paired in the matching PK pattern application, and the identification information may be an object ID.
When the state of the object to be queried needs to be determined, acquiring identification information of the object to be queried, and determining the state of the object to be queried by querying the identification information of the object to be queried in an identification set; if the identification set contains identification information of the object to be queried, determining the state of the object to be queried as a state to be matched after applying for matching; and if the identification set does not contain the identification information of the object to be queried, determining that the object to be queried does not apply for matching in the matched PK mode.
The state query method provided by the embodiment of the disclosure can avoid too many requests for accessing the cache regions and too much pairing information of an object applying for PK stored in one cache region, which are caused by too many requests for querying the state of the object to be queried. Whether the pairing information of the object to be inquired is stored in the cache region or not is inquired from the identification set, so that the efficiency of inquiring the state of the object to be inquired is improved.
According to the method for determining whether the cache region contains the pairing information of the object to be queried, the embodiment of the disclosure further provides a state query method. May be applied in the context of providing a set of pairings for a subject applying for a PK in the invite PK mode.
Fig. 5 is a flowchart illustrating an overall process of another method for providing a pairing set for a PK applied for a subject in an invited PK mode, according to an exemplary embodiment, as shown in fig. 5, including the steps of:
in step S501, an object applies for matching to an API service node through a client;
in step S502, the API service node stores the pairing information of the object in a cache area;
in step S503, the API service node determines that the pairing information is successfully stored;
in step S504, the API service node stores the identification information of the object in an identification set;
in step S505, the API service node determines that the storage of the identification information is successful;
in step S506, the API service node returns a waiting pairing response to the client;
the steps S501 to S506 are a process of storing pairing information of the object applying for PK in the matching PK mode into a buffer area, and a process of pre-storing identification information of the object applying for PK in the matching PK mode into an identification set;
in step S507, the object sends a pairing set generation instruction to the API service node through the client;
in step S508, the API service node obtains a buddy list of the object from the user relationship service node;
in step S509, the user relationship service node returns the buddy list of the object;
in step S510, the API service node obtains identification information of an online object in a buddy list of the object from the online live broadcast service node;
at the moment, the online object is the object to be inquired;
in step S511, the online live broadcast service node returns the identification information of the online object in the buddy list of the object to the API service node;
in step S512, the API service node queries, in the identifier set, identifier information of an online object in the buddy list;
in step S513, the API service node obtains a query result whether the online object is in the identifier set;
in step S514, the API service node takes an online object that is not in the identification set as a target object, and adds identification information of the target object to the pairing set;
in step S515, the API service node returns the pairing set to the client.
The embodiment of the disclosure further provides a method for determining whether the plurality of cache regions contain pairing information of the object to be queried according to the identification information of the object to be queried.
And if the corresponding relation between the pre-stored identification information and the state information of the object contains the state information corresponding to the identification information of the object to be inquired, determining that the plurality of cache regions contain the pairing information of the object to be inquired.
According to the method and the device, whether the corresponding relation between the identification information and the state information contains the state information corresponding to the identification information of the object to be inquired or not is inquired, whether the matching information of the object to be inquired is stored in the plurality of cache regions or not is determined, the problem that inquiry response is too slow due to the fact that the number of the matching information in the cache regions is too large and the number of requests for inquiring the state of the object to be inquired by accessing the cache regions is too large is avoided, and the efficiency of inquiring the state of the object to be inquired is improved.
Specifically, when the pairing information of the PK applying object is stored in a plurality of cache areas, a corresponding status information is added to the identification information of the PK applying object and stored.
In an implementation, the corresponding relationship between the identification information and the state information may be stored in a specific cache region, where the identification information of the object matching the PK pattern application and the corresponding state information are stored in the cache region, where the cache region may store only one identification information of each object matching the PK pattern application, and the identification information may be an object ID; the status information corresponding to the identification information is not limited, and may be 0 or 1.
For example, the matched objects are applied to the matched PK pattern as U1, U2 and U3. Identification information of the object U1 is 1480000XXXX; identification information of the object U2 is 1452333XXXX; the identification information of the object U3 is 1892475XXXX. When the objects U1, U2 and U3 apply for matching in the matched PK mode, the identification information of the objects U1, U2 and U3 and the corresponding state information thereof are respectively stored in a single cache region. The content stored in the cache area is the correspondence between the identification information and the status information of the objects U1, U2, U3, for example, "1480000xxxx +1", "1452333xxx +1", "1892475xxxx +1".
Here, "1" is used as the status information for example, and does not limit the present disclosure.
When the state of the object to be queried needs to be determined, acquiring whether the corresponding relation between the pre-stored identification information and the state information contains the state information corresponding to the identification information of the object to be queried: if state information corresponding to the identification information of the object to be queried is queried, determining that the pairing information of the object to be queried is stored in a plurality of cache areas; and if the state information corresponding to the identification information is not inquired, determining that the pairing information of the object to be inquired is stored in the plurality of cache areas.
For example, the representation information of the object U4 to be queried is 1523647XXXX, and the correspondence between the pre-stored identification information and the state information includes: "1480000XXXX +1, 1452333XXXX +1, 1892475XXXXXX +1". Searching in a pre-stored corresponding relation according to the identification information '1523647 XXXX' of the object to be queried, and determining that the pairing information of the object to be queried is stored in a plurality of cache regions if the state information corresponding to the identification information '1523647 XXXXXX' is not queried.
In addition, the embodiment of the disclosure further provides a matching method, which is applied to a PK matching mode, when a PK matching object needs to be applied, the matching information in the plurality of cache regions is read in parallel by the plurality of processing threads corresponding to the plurality of cache regions, and the PK matching object is matched according to the read matching information. When the objects are matched, the matching information of the objects which are matched is stored in the plurality of cache regions, and when the objects to be matched are matched, the matching information of the objects to be matched is read through a plurality of processing threads corresponding to the plurality of cache regions, so that the objects to be matched are matched. The matching information of the object to be matched is stored in the cache areas, so that when the objects to be matched are too many, the matching information of the object to be matched is read in parallel by the processing threads corresponding to the cache areas, the time for reading the matching information by a single processing thread can be shortened, the response speed is increased, and the execution efficiency of the task for matching the object to be matched can be effectively improved.
It should be noted that, in the embodiment of the present disclosure, a specific number of the cache regions for storing the pairing information of the object to be matched is not limited, and the number of the cache regions may be a numerical value preset by a person skilled in the art. For example, the pairing information of the objects to be matched is stored in 10 cache regions, and when the pairing information of the objects to be matched is read, the pairing information of the objects to be matched in the 10 cache regions is read in parallel through the processing threads corresponding to the 10 cache regions.
FIG. 6 is a schematic diagram illustrating multiple buffers, where different buffers correspond to different processing threads, in accordance with an illustrative embodiment. As shown in fig. 6, it is assumed that pairing information of objects to be paired is stored in 10 cache regions, each cache region has a number, each cache region corresponds to one processing thread, and the numbers of the 10 cache regions are 0 to 9 respectively and correspond to the processing threads T0 to T9 respectively.
Before object pairing is needed, pairing information of objects to be matched is stored in a plurality of cache regions.
The pairing information of the object to be matched in the embodiment of the present disclosure includes, but is not limited to:
identification information, pairing type and application time of the object to be matched;
it should be noted that, because there are many specific information included in the pairing information of the objects to be matched, they cannot be listed one by one; the information included in the pairing information of the object to be matched is exemplary, and does not limit the protection scope of the embodiment of the present disclosure.
The embodiment of the disclosure provides a method for storing pairing information of objects to be matched to a plurality of cache areas.
Selecting a cache region for storing pairing information of the objects to be matched from the plurality of cache regions according to the identification information of the objects to be matched; and storing the pairing information of the object to be matched to the selected cache region through the processing thread corresponding to the selected cache region.
In implementation, according to the embodiment of the present disclosure, a cache region for storing pairing information of an object to be matched needs to be selected from a plurality of cache regions according to identification information of the object to be matched, and then the pairing information of the object to be matched is stored in the cache region through a processing thread corresponding to the selected cache region. Specifically, the cache region for storing the pairing information of the object to be matched may be selected from the plurality of cache regions according to the ID of the object to be matched, and the ID of the object to be matched may be a mobile phone number used when registering the object to be matched.
The following describes in detail a method for selecting a cache region for storing pairing information of an object to be matched from a plurality of cache regions according to identification information of the object to be matched according to the embodiment of the present disclosure.
One optional implementation manner is that a hash value obtained by performing hash operation on identification information of an object to be matched is determined, and a modulus operation is performed on the determined hash value and the number of cache areas; and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object to be matched.
The input with any length can be converted into the output with the fixed length through the Hash operation, the Hash value converted from the identification information of the object to be matched is a random number, and when the matching information of the object to be matched is stored in which cache region according to the Hash value obtained from the identification information of the object to be matched, the randomness is strong, the matching information of the object to be matched can be distributed in a plurality of cache regions more uniformly, and the condition that the speed of reading the matching information of the object to be matched in the plurality of cache regions in parallel is influenced by the excessive matching information of the object to be matched stored in one cache region is avoided.
Specifically, after the identification information of the object to be matched is determined, hash operation is performed on the identification information of the object to be matched to obtain a hash value corresponding to the identification information of the object to be matched, modulo operation is performed on the hash value corresponding to the identification information of the object to be matched and the number of cache regions to obtain an operation result of the hash value, and the cache region corresponding to the cache region with the same cache region number as the operation result is the cache region for storing the pairing information of the object to be matched.
In the following, a cache area for storing pairing information of an object to be matched is selected from 10 cache areas as an example.
For example, the identification information of the object to be matched is 1530000XXXX, hash operation is performed on the identification information to obtain a corresponding hash value, and it is assumed that the hash value corresponding to the identification information is 22.
It should be noted that the number of the cache regions, the identification information of the objects to be matched, and the hash value corresponding to the identification information obtained through the hash operation in the embodiment of the present disclosure are only examples, and are only used to illustrate the method for selecting the cache region storing the pairing information of the objects to be matched according to the identification information of the objects to be matched provided in the embodiment of the present disclosure. The hash value corresponding to the identification information obtained by the hash operation may be obtained by using a method in the prior art, which is not described in detail herein.
And performing modular operation on the determined hash value and the number of the cache regions to obtain an operation result. If the number of the cache regions is 10, performing modulo operation on the hash value 22 and the number of the cache regions 10:
22% by weight, 10=2, i.e., the result of the operation is 2.
And selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object to be matched. If the result of the modulo operation is 2, the cache region with the number of 2 is selected as the pairing information for storing the object to be paired with the identification information of 1530000 XXXX.
After a cache region used for storing the pairing information of the objects to be matched is selected, the pairing information of the objects to be matched is stored in the cache region through the thread corresponding to the selected cache region. Specifically, the thread T2 corresponding to the cache region with the number of 2 stores the pairing information of the object to be paired with the identification information of 1530000XXXX into the cache region.
When there are many objects to be matched, hash values obtained by hashing identification information of the objects to be matched through hash operation are many and random, assuming that the number of the cache regions is 10, and a result obtained by performing modulo operation on the obtained hash values and the number of the cache regions may be any number from 0 to 9, then:
storing the pairing information of the object to be matched with the modulus operation result of 0 into a cache region with the number of 0 through a processing thread T0; storing the pairing information of the object to be matched with the modular operation result of 1 into a cache region with the number of 1 through a processing thread T1; storing the pairing information of the object to be matched with the modular operation result of 2 into a cache region with the serial number of 2 through a processing thread T2; storing the pairing information of the object to be matched with the modular arithmetic result of 3 into a cache region with the serial number of 3 through a processing thread T3; storing the pairing information of the object to be matched with the modular operation result of 4 into a cache region with the serial number of 4 through a processing thread T4; storing the pairing information of the object to be matched with the modular operation result of 5 into a cache region with the serial number of 5 through a processing thread T5; storing the pairing information of the object to be matched with the modular operation result of 6 into a buffer area with the serial number of 6 through a processing thread T6; storing the pairing information of the object to be matched with the modular operation result of 7 into a cache region with the serial number of 7 through a processing thread T7; storing the pairing information of the object to be matched with the modular operation result of 8 into a cache region with the serial number of 8 through a processing thread T8; and storing the pairing information of the object to be matched with the modular operation result of 9 into the buffer area with the number of 9 through the processing thread T9.
After the pairing information of the objects to be matched is stored in the corresponding cache regions, when the objects are required to be paired, the pairing information of the objects to be matched in the multiple cache regions can be read in parallel through the processing threads corresponding to the multiple cache regions.
For example, the pairing information of the objects to be matched stored in the buffers 0 to 9 may be read in parallel by the processing threads T0 to T9. Specifically, the pairing information of the object to be matched, which is stored in the cache region with the serial number of 0, is read through the processing thread T0; reading the pairing information of the object to be matched, which is stored in the cache region with the number of 1, through the processing thread T1; reading the pairing information of the object to be matched, which is stored in the cache region with the number of 2, through the processing thread T2; reading the pairing information of the object to be matched, which is stored in the cache region with the number of 3, through the processing thread T3; reading the pairing information of the object to be matched, which is stored in the cache region with the serial number of 4, through a processing thread T4; reading the pairing information of the objects to be matched, which is stored in the cache region with the serial number of 5, through a processing thread T5; reading the pairing information of the object to be matched, which is stored in the cache region with the serial number of 6, through a processing thread T6; reading the pairing information of the object to be matched, which is stored in the cache region with the number of 7, through the processing thread T7; reading the pairing information of the object to be matched, which is stored in the cache region with the serial number of 8, through a processing thread T8; and reading the pairing information of the object to be matched, which is stored in the cache region with the number of 9, through the processing thread T9.
Compared with the mode of reading the pairing information of the objects to be matched in the cache region in the prior art, the mode of reading the pairing information of the objects to be matched provided by the embodiment of the disclosure has the advantages that the time for reading the pairing information of the objects to be matched is shortened, the response speed is increased, and the execution efficiency of the task for pairing the objects to be matched can be effectively improved.
And after the pairing information of the objects to be matched, which is stored in the plurality of cache areas, is read, object pairing is carried out on the objects to be matched according to the pairing information of the objects to be paired.
Specifically, the objects to be matched with the same pairing type in the pairing information may be paired.
For example, objects to be matched, of which the matching types are all "games", in the matching information are matched;
or the pairing information of the objects to be matched also comprises the geographic positions of the objects to be matched, and the pairing type is selected to be in the same city and the objects to be matched in the same city are paired.
FIG. 7 is a complete flow diagram illustrating a matching method according to an exemplary embodiment, as shown in FIG. 7, including the steps of:
in step S701, after the object to be matched applies for matching, a hash value obtained by performing hash operation on the identification information of the object to be matched;
in step S702, performing a modulo operation on the hash value corresponding to the identification information and the number of cache areas;
in step S703, a cache region having the same number as the result of the modulo operation is selected from the plurality of cache regions;
in step S704, storing the pairing information of the object to be matched to the selected cache area through the processing thread corresponding to the selected cache area;
in step S705, when object pairing is required, the pairing information of the objects to be matched in the plurality of cache regions is read in parallel through the processing threads corresponding to all the cache regions;
in step S706, object pairing is performed according to the read pairing information of the object to be matched.
The following describes a matching method provided by the present disclosure, taking five objects to be matched as an example.
Suppose that the objects to be matched are U1, U2, U3, U4, U5, respectively. The identification information of the object U1 to be matched is 1480000XXXX, and the matching type is 'talent art'; the identification information of the object U2 to be matched is 1452333XXXX, and the matching type is game; the identification information of the object U3 to be matched is 1892475XXXX, and the matching type is 'same city'; the identification information of the object to be matched U4 is 1954723XXXX, and the matching type is game; the identification information of the object U5 to be matched is 156842 XXXXXX, and the matching type is 'talent skill'.
1. And obtaining hash values by respectively hashing the identification information of the object to be matched, wherein the hash values corresponding to the identification information obtained by hash operation can be obtained by adopting a mode in the prior art, and are not described in detail herein.
Supposing that a hash value obtained by carrying out hash operation on the identification information of the object U1 to be matched is 26;
the hash value obtained by performing hash operation on the identification information of the object U2 to be matched is 89;
the hash value obtained by performing hash operation on the identification information of the object U3 to be matched is 42;
the hash value obtained by performing hash operation on the identification information of the object U4 to be matched is 44;
the hash value obtained by performing hash operation on the identification information of the object U5 to be matched is 37.
2. And performing modular operation on the hash value corresponding to the identification information and the number of the cache regions, taking the number of the cache regions as 10 as an example.
Object to be matched U1:26 = 10=6;
an object to be matched U2:89% = 10 "= 9;
object to be matched U3:42 = 10=2;
object to be matched U4:44 = 10=4;
object to be matched U5:37% = 10=7.
3. And selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object to be matched.
Selecting a buffer area with the number of 6 as a buffer area for storing the pairing information of the U1;
selecting a cache region with the number of 9 as a cache region for storing the pairing information of the U2;
selecting the cache region with the number of 2 as a cache region for storing the pairing information of the U3;
selecting a cache region with the number of 4 as a cache region for storing the pairing information of the U4;
and selecting the buffer area with the number of 7 as a buffer area for storing the pairing information of the U5.
4. And storing the pairing information of the object to be matched to the selected cache region through the processing thread corresponding to the selected cache region.
Storing the pairing information of the U1 to a buffer area with the number of 6 through a processing thread T6;
storing the pairing information of the U2 to a cache region with the number of 9 through a processing thread T9;
storing the pairing information of the U3 to a cache region with the number of 2 through a processing thread T2;
storing the pairing information of the U4 to a cache region with the number of 4 through a processing thread T4;
the pairing information of U5 is stored to the buffer area numbered 7 by the processing thread T7.
It should be noted that, when the matching information of the objects to be matched is stored through the processing thread corresponding to the selected cache region, the matching information of the objects to be matched, which are applied for matching within a period of time, may be stored in parallel, or may be stored sequentially according to the application time sequence. When the objects to be matched applying for matching are too many, the matching information of a plurality of objects to be matched can be stored through a plurality of processing threads.
5. When the objects need to be paired, the pairing information of the objects to be matched in the multiple cache regions is read in parallel through the processing threads corresponding to all the cache regions.
When object pairing is required, the pairing information of U1, U2, U3, U4 and U5 is read in parallel through T2, T4, T6, T7 and T9.
It should be noted that, in the embodiment of the present disclosure, only 5 objects to be matched are taken as an example, in an actual situation, a large amount of pairing information of the objects to be matched may be stored in all preset cache regions, and the pairing information in all the cache regions needs to be read in parallel by processing threads of all the cache regions.
6. And carrying out object pairing according to the read pairing information of the object to be matched.
After the pairing information of U1, U2, U3, U4, and U5 is read, pairing may be performed according to the pairing type of the object to be matched. Matching U1 with U5 to obtain talent PK; matching U2 with U4 to play a game PK; if U3 does not have a suitable object to be matched for pairing, the pairing information of U3 may be stored again in the cache region numbered 2 by the processing thread T2, and the next pairing is waited.
FIG. 8 is an interactive flow diagram illustrating a matching method, according to an exemplary embodiment, as shown in FIG. 8, including the steps of:
in step S801, an object to be matched applies for matching to an API service node through a client;
in step S802, the API service node selects a cache region for storing matching information of the object to be matched from the plurality of cache regions according to the identification information of the object to be matched, and stores the matching information of the object to be matched to the selected cache region;
in step S803, the API service node determines that the pairing information is successfully stored;
in step S804, the API service node returns a waiting pairing response to the client;
in step S805, the runner node reads the pairing information of the objects to be matched in the plurality of cache regions in parallel through the processing threads corresponding to all the cache regions;
in step S806, the runner node determines that the pairing information of the object to be matched is successfully read;
in step S807, the runner node pairs according to the read pairing information of the object to be matched;
in step S808, the runner node stores the pairing combination information successfully paired in the pairing combination cache area;
the pairing combination information comprises pairing information of paired objects;
in step S809, the API service node determines a matching object corresponding to the object to be matched according to the pairing combination information stored in the pairing combination cache region;
in step S810, the API service node returns a matching object corresponding to the object to be matched to the client, and notifies the object to be matched and the corresponding matching object to perform PK.
The embodiment of the present disclosure further provides a state query device, and as the device is a device corresponding to the state query method in the embodiment of the present disclosure, and the principle of the device for solving the problem is similar to that of the method, the implementation of the device may refer to the implementation of the method, and repeated details are not repeated.
Fig. 9 is a block diagram illustrating a state query device in accordance with an example embodiment. Referring to fig. 9, the apparatus includes an obtaining module 900 and a determining module 901.
An obtaining module 900 configured to execute a response status query instruction, and obtain identification information of an object to be queried from the status query instruction;
a determining module 901, configured to determine that the state of the object to be queried is a state to be matched after applying for matching if it is determined that the plurality of cache regions include pairing information of the object to be queried according to the identification information of the object to be queried; the cache regions are used for storing pairing information of objects applying for matching.
In a possible implementation manner, the determining module 901 is configured to perform determining a cache corresponding to the identification information of the object to be queried; and if the determined cache regions contain the pairing information of the objects to be inquired, determining that the plurality of cache regions contain the pairing information of the objects to be inquired.
In a possible implementation manner, the determining module 901 is configured to determine a hash value obtained by performing a hash operation on the identification information of the object to be queried, and perform a modular operation on the determined hash value and the number of cache regions; and taking the cache region with the same number as the modular operation result as the cache region corresponding to the identification information of the object to be inquired.
In a possible implementation manner, the apparatus further includes a storage module configured to select, after the object applies for matching, a cache region for storing pairing information of the object from the plurality of cache regions according to the identification information of the object; and storing the pairing information of the object to the selected cache region through a processing thread corresponding to the selected cache region.
In a possible implementation manner, the storage module is configured to determine a hash value obtained by performing a hash operation on the identification information of the object, and perform a modulo operation on the determined hash value and the number of cache areas; and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object.
In a possible implementation manner, the determining module 901 is configured to determine that the plurality of cache regions include the pairing information of the object to be queried if it is determined that the pre-stored identification set includes the identification information of the object to be queried; and the identification set comprises identification information of the object applying for matching.
In a possible implementation manner, the determining module 901 is configured to determine that the plurality of cache regions include the pairing information of the object to be queried if the pre-stored correspondence between the identification information and the state information of the object includes the state information corresponding to the identification information of the object to be queried.
With regard to the apparatus in the above embodiment, the specific manner in which each unit executes the request has been described in detail in the embodiment related to the method, and will not be elaborated here.
Fig. 10 is a block diagram illustrating an electronic device 1000 according to an example embodiment, the electronic device including:
a processor 1010;
a memory 1020 for storing instructions executable by the processor 1010;
wherein the processor 1010 is configured to execute the instructions to implement the state query method in the embodiments of the present disclosure.
In an exemplary embodiment, a non-volatile storage medium comprising instructions, such as the memory 1020 comprising instructions, executable by the processor 1010 of the electronic device 1000 to perform the above-described method is also provided. Alternatively, the storage medium may be a non-transitory computer readable storage medium, which may be, for example, a ROM, a Random Access Memory (RAM), a CD-ROM, a magnetic tape, a floppy disk, an optical data storage device, and the like.
The embodiment of the present disclosure further provides a computer program product, which when running on an electronic device, causes the electronic device to execute any one of the above-mentioned state query methods or any one of the methods that may be involved in implementing any one of the above-mentioned state query methods according to the embodiment of the present disclosure.
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 disclosure 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.
It will be understood that the present disclosure is not limited to the precise arrangements that have been described above and shown in the drawings, and that various modifications and changes may be made without departing from the scope thereof. The scope of the present disclosure is limited only by the appended claims.

Claims (16)

1. A method for querying a status, the method comprising:
responding to a state query instruction, and acquiring identification information of an object to be queried from the state query instruction;
if the plurality of cache regions contain the pairing information of the objects to be queried according to the identification information of the objects to be queried, determining the state of the objects to be queried as the state to be matched after application for matching; the cache regions are used for storing the pairing information of the object applying for matching, and the pairing information of the object is stored in the cache regions after the object applying for matching.
2. The method of claim 1, wherein the determining, according to the identification information of the object to be queried, pairing information that includes the object to be queried in a plurality of buffers comprises:
determining a cache region corresponding to the identification information of the object to be queried;
and if the determined cache regions contain the pairing information of the objects to be inquired, determining that the plurality of cache regions contain the pairing information of the objects to be inquired.
3. The method as claimed in claim 2, wherein said determining the cache corresponding to the identification information of the object to be queried comprises:
determining a hash value obtained by performing hash operation on the identification information of the object to be queried, and performing modular operation on the determined hash value and the number of cache areas;
and taking the cache region with the same number as the modulo operation result as the cache region corresponding to the identification information of the object to be inquired.
4. The method of claim 3, wherein prior to responding to the status query instruction, the method further comprises:
after the object applies for matching, selecting a cache region for storing pairing information of the object from a plurality of cache regions according to the identification information of the object;
and storing the pairing information of the object to the selected cache region through a processing thread corresponding to the selected cache region.
5. The method of claim 4, wherein the selecting a cache region for storing pairing information of the object from a plurality of cache regions according to the identification information of the object comprises:
determining a hash value obtained by performing hash operation on the identification information of the object, and performing modular operation on the determined hash value and the number of cache areas;
and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object.
6. The method of claim 1, wherein the determining, according to the identification information of the object to be queried, pairing information that includes the object to be queried in a plurality of buffers comprises:
if the pre-stored identification set contains the identification information of the object to be queried, determining that a plurality of cache regions contain the pairing information of the object to be queried; and the identification set comprises identification information of the object applying for matching.
7. The method of claim 1, wherein the determining, according to the identification information of the object to be queried, pairing information that includes the object to be queried in a plurality of buffers comprises:
and if the corresponding relation between the pre-stored identification information and the state information of the object comprises the state information corresponding to the identification information of the object to be inquired, determining that the plurality of cache regions comprise the pairing information of the object to be inquired.
8. A status query device, comprising:
the acquisition module is configured to execute a response state query instruction and acquire identification information of an object to be queried from the state query instruction;
the determining module is configured to determine that the state of the object to be queried is a state to be matched after applying for matching if the plurality of cache regions are determined to contain the pairing information of the object to be queried according to the identification information of the object to be queried; the cache regions are used for storing the pairing information of the object applying for matching, and the pairing information of the object is stored in the cache regions after the object applying for matching.
9. The apparatus of claim 8, wherein the determining module is configured to perform determining a cache corresponding to identification information of the object to be queried; and if the determined cache regions contain the pairing information of the objects to be inquired, determining that the plurality of cache regions contain the pairing information of the objects to be inquired.
10. The apparatus according to claim 9, wherein the determining module is configured to perform a hash value obtained by performing a hash operation on the identification information of the object to be queried, and perform a modulo operation on the determined hash value and the number of cache regions; and taking the cache region with the same number as the modular operation result as the cache region corresponding to the identification information of the object to be inquired.
11. The apparatus of claim 10, further comprising:
the storage module is configured to select a cache region for storing the pairing information of the object from a plurality of cache regions according to the identification information of the object after the object applies for matching; and storing the pairing information of the object to the selected cache region through a processing thread corresponding to the selected cache region.
12. The apparatus of claim 11, wherein the storage module is configured to perform determining a hash value obtained by hashing identification information of the object, and performing modulo operation on the determined hash value and the number of cache regions; and selecting the cache region with the same number as the modulo operation result as the cache region for storing the pairing information of the object.
13. The apparatus of claim 8, wherein the determining module is configured to determine pairing information of the object to be queried in a plurality of buffers if it is determined that the pre-stored identification set includes identification information of the object to be queried; and the identification set comprises identification information of the object applying for matching.
14. The apparatus according to claim 8, wherein the determining module is configured to determine that the plurality of buffers contain the pairing information of the object to be queried if a pre-stored correspondence between identification information and status information of the object contains status information corresponding to the identification information of the object to be queried.
15. An electronic device, comprising:
a processor;
a memory for storing the processor-executable instructions;
wherein the processor is configured to execute the instructions to implement the method of making a status query according to any one of claims 1 to 7.
16. A storage medium, wherein instructions in the storage medium, when executed by a processor of a status-querying electronic device, enable the status-querying electronic device to perform the status-querying method of any one of claims 1 to 7.
CN201911046577.5A 2019-10-30 2019-10-30 State query method and device and electronic equipment Active CN110795632B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911046577.5A CN110795632B (en) 2019-10-30 2019-10-30 State query method and device and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911046577.5A CN110795632B (en) 2019-10-30 2019-10-30 State query method and device and electronic equipment

Publications (2)

Publication Number Publication Date
CN110795632A CN110795632A (en) 2020-02-14
CN110795632B true CN110795632B (en) 2022-10-04

Family

ID=69442161

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911046577.5A Active CN110795632B (en) 2019-10-30 2019-10-30 State query method and device and electronic equipment

Country Status (1)

Country Link
CN (1) CN110795632B (en)

Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226637B1 (en) * 1997-05-09 2001-05-01 International Business Machines Corp. System, method, and program, for object building in queries over object views
WO2014014840A1 (en) * 2012-07-17 2014-01-23 Riot Games, Inc. Systems and methods that enable player matching for multi-player online games
CN104426661A (en) * 2013-09-05 2015-03-18 腾讯科技(深圳)有限公司 User account matching method and device
CN106453238A (en) * 2016-08-22 2017-02-22 深圳市先河系统技术有限公司 Login method and system, electronic terminal, public network server and private cloud device
CN107103089A (en) * 2017-05-04 2017-08-29 腾讯科技(深圳)有限公司 The matching process and device of object
CN107528816A (en) * 2016-06-22 2017-12-29 中兴通讯股份有限公司 ID processing method, management system and server in distributed data base
CN107837532A (en) * 2017-11-16 2018-03-27 腾讯科技(上海)有限公司 User matching method, device, server and storage medium
CN107967635A (en) * 2016-10-19 2018-04-27 阿里巴巴集团控股有限公司 A kind of information matching method and device
CN108733668A (en) * 2017-04-13 2018-11-02 百度在线网络技术(北京)有限公司 Method and apparatus for inquiring data
CN109304033A (en) * 2018-08-31 2019-02-05 杭州复杂美科技有限公司 A kind of computer game system and method, equipment and storage medium
CN109499058A (en) * 2018-11-20 2019-03-22 网易(杭州)网络有限公司 Matching in game determines method and device
CN109582700A (en) * 2018-11-28 2019-04-05 广州华多网络科技有限公司 A kind of voice room user matching method, device and equipment

Family Cites Families (20)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6789116B1 (en) * 1999-06-30 2004-09-07 Hi/Fn, Inc. State processor for pattern matching in a network monitor device
US20090132345A1 (en) * 2004-02-13 2009-05-21 Bahram Meyssami Method and system for determining relevant matches based on attributes
CN100550070C (en) * 2005-06-01 2009-10-14 华为技术有限公司 Make the method and the game services end of game account number entering game state
CN102006330B (en) * 2010-12-01 2013-06-12 北京瑞信在线系统技术有限公司 Distributed cache system, data caching method and inquiring method of cache data
CN103577158B (en) * 2012-07-18 2017-03-01 阿里巴巴集团控股有限公司 Data processing method and device
CN104765754A (en) * 2014-01-08 2015-07-08 北大方正集团有限公司 Data storage method and device
CN105302840B (en) * 2014-07-31 2019-11-15 阿里巴巴集团控股有限公司 A kind of buffer memory management method and equipment
CN104463627B (en) * 2014-12-05 2017-12-19 北京国双科技有限公司 Data processing method and device
CN104580162B (en) * 2014-12-17 2019-10-22 腾讯科技(深圳)有限公司 User account matching method and device, the method and device for initiating unpaired message
CN106156243A (en) * 2015-04-26 2016-11-23 上海灵域网络科技有限公司 A kind of social entertainment method and system
CN108605049A (en) * 2015-12-29 2018-09-28 三星电子株式会社 The message sharing method based on application state and card for user equipment
CN107562669B (en) * 2016-06-30 2020-04-07 北京忆芯科技有限公司 NVMe protocol command processing method, device and system
US10380110B2 (en) * 2016-12-21 2019-08-13 Salesforce.Com, Inc. Explore query caching
CN106649139B (en) * 2016-12-29 2020-01-10 北京奇虎科技有限公司 Data elimination method and device based on multiple caches
CN108182213A (en) * 2017-12-20 2018-06-19 福建新大陆软件工程有限公司 A kind of data processing optimization device and method based on distributed system
CN108566291B (en) * 2018-02-13 2020-04-28 北京三快在线科技有限公司 Event processing method, server and system
CN108446341B (en) * 2018-03-02 2020-11-03 平安普惠企业管理有限公司 Service state query method and device, computer equipment and storage medium
CN108921712A (en) * 2018-06-13 2018-11-30 泰康保险集团股份有限公司 Data processing method, device, medium and electronic equipment
CN109191233B (en) * 2018-07-31 2022-09-02 上海幻电信息科技有限公司 Second order-killing request processing method and device and storage medium
CN110267053A (en) * 2019-06-27 2019-09-20 广州酷狗计算机科技有限公司 Live broadcasting method, apparatus and system

Patent Citations (12)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6226637B1 (en) * 1997-05-09 2001-05-01 International Business Machines Corp. System, method, and program, for object building in queries over object views
WO2014014840A1 (en) * 2012-07-17 2014-01-23 Riot Games, Inc. Systems and methods that enable player matching for multi-player online games
CN104426661A (en) * 2013-09-05 2015-03-18 腾讯科技(深圳)有限公司 User account matching method and device
CN107528816A (en) * 2016-06-22 2017-12-29 中兴通讯股份有限公司 ID processing method, management system and server in distributed data base
CN106453238A (en) * 2016-08-22 2017-02-22 深圳市先河系统技术有限公司 Login method and system, electronic terminal, public network server and private cloud device
CN107967635A (en) * 2016-10-19 2018-04-27 阿里巴巴集团控股有限公司 A kind of information matching method and device
CN108733668A (en) * 2017-04-13 2018-11-02 百度在线网络技术(北京)有限公司 Method and apparatus for inquiring data
CN107103089A (en) * 2017-05-04 2017-08-29 腾讯科技(深圳)有限公司 The matching process and device of object
CN107837532A (en) * 2017-11-16 2018-03-27 腾讯科技(上海)有限公司 User matching method, device, server and storage medium
CN109304033A (en) * 2018-08-31 2019-02-05 杭州复杂美科技有限公司 A kind of computer game system and method, equipment and storage medium
CN109499058A (en) * 2018-11-20 2019-03-22 网易(杭州)网络有限公司 Matching in game determines method and device
CN109582700A (en) * 2018-11-28 2019-04-05 广州华多网络科技有限公司 A kind of voice room user matching method, device and equipment

Non-Patent Citations (4)

* Cited by examiner, † Cited by third party
Title
ID-Match: A Hybrid Computer Vision and RFID System for Recognizing Individuals in Groups;Hanchuan Li;《Proceedings of the 2016 CHI Conference Extended Abstracts on Human Factors in Computing Systems》;20160507;4933-4944 *
Towards differential query services in cost-efficient clouds;Qin Liu;《 IEEE Transactions on Parallel and Distributed Systems 》;20130513;第25卷(第6期);1648-1658 *
一种流数据实时写入保障下的数据查询方法;侯荣军;《计算机应用研究》;20140930(第9期);2736-2740 *
业余足球俱乐部管理平台的初步设计与实现;王珏辉;《电脑编程技巧与维护》;20170403(第07期);50-51 *

Also Published As

Publication number Publication date
CN110795632A (en) 2020-02-14

Similar Documents

Publication Publication Date Title
KR102330643B1 (en) Method and related device for realizing user matching
CN107690085B (en) Data sharing method and device
CN110573221A (en) user driven spectator channel for live game play in a multiplayer game
CN110856032B (en) Live broadcast method, device, equipment and storage medium
CN113473169B (en) Group live broadcasting method and device, storage medium and computer equipment
CN104623898A (en) Method for entering game copy scene and game server
CN104243598A (en) Information recommendation method and device
US10112110B1 (en) Initiating a game session with broadcast subscribers
CN115955590A (en) Video processing method, video processing device, computer equipment and medium
CN110795632B (en) State query method and device and electronic equipment
CN105099727B (en) Add the method and device of group member
CN110138721B (en) Method of decoupling gaming and combat services, storage medium
CN109618187B (en) Video data acquisition method and device
CN113730921B (en) Recommendation method and device for virtual organization, storage medium and electronic equipment
KR20220159968A (en) Conference handling method and system using avatars
CN111803924A (en) Multi-terminal synchronous display method and device of cloud game and readable storage medium
KR20130122836A (en) System for sharing augmented reality contents and method thereof
JP6389408B2 (en) Program, providing system, and control method
CN113259225B (en) Instant messaging method, server and instant messaging system
CN113018852B (en) Data processing method and data processing device
CN117717769A (en) Data processing method, device, equipment and medium
CN110585714B (en) UGC element setting method, device and equipment based on block chain
CN116567334A (en) Virtual character nickname display method and device, storage medium and electronic equipment
US10380555B2 (en) Policy driven online meeting updates
CN117618894A (en) Interaction method, device, equipment and storage medium

Legal Events

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