CN110399367B - Business data processing method and device, computer equipment and storage medium - Google Patents

Business data processing method and device, computer equipment and storage medium Download PDF

Info

Publication number
CN110399367B
CN110399367B CN201810326405.2A CN201810326405A CN110399367B CN 110399367 B CN110399367 B CN 110399367B CN 201810326405 A CN201810326405 A CN 201810326405A CN 110399367 B CN110399367 B CN 110399367B
Authority
CN
China
Prior art keywords
data
service data
candidate
target
candidate service
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
CN201810326405.2A
Other languages
Chinese (zh)
Other versions
CN110399367A (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.)
Tencent Technology Shenzhen Co Ltd
Original Assignee
Tencent Technology Shenzhen 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 Tencent Technology Shenzhen Co Ltd filed Critical Tencent Technology Shenzhen Co Ltd
Priority to CN201810326405.2A priority Critical patent/CN110399367B/en
Publication of CN110399367A publication Critical patent/CN110399367A/en
Application granted granted Critical
Publication of CN110399367B publication Critical patent/CN110399367B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Abstract

The application relates to a business data processing method, which comprises the following steps: acquiring a candidate service identifier of service data to be cached; acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode; storing the candidate service data into a data cache region, distributing an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence. The business data processing method not only improves the speed of data return and reduces the time delay, but also greatly reduces the interaction pressure between the terminal and the server. In addition, a business data processing device, a computer device and a storage medium are also provided.

Description

Business data processing method and device, computer equipment and storage medium
Technical Field
The present application relates to the field of computer processing technologies, and in particular, to a method and an apparatus for processing service data, a computer device, and a storage medium.
Background
During the continuous iteration process of the software, the demand of the product is continuously changed. When the client deals with a new demand, data needs to be acquired from the background service. However, as the demand increases, the data that the client needs to obtain from the background also increases, and for different demands, the client often needs to obtain data from a plurality of different background services, and then the background services need to obtain data from the database or other storage devices and return the data to the client, which causes a delay from the initiation of the request by the client to the receipt of all the data to be large, and when the demand data is large, the interaction pressure between the client and the server is too large.
Disclosure of Invention
In view of the foregoing, it is desirable to provide a service data processing method, an apparatus, a computer device, and a storage medium, which can reduce latency and reduce interaction pressure between a client and a server.
A method for processing service data, the method comprising:
acquiring a candidate service identifier of service data to be cached;
acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
storing the candidate service data into a data cache region, allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
A traffic data processing apparatus, the apparatus comprising:
the identification acquisition module is used for acquiring a candidate service identification of the service data to be cached;
the polling module is used for acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
and the storage module is used for storing the candidate service data into a data cache region, allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
In one embodiment, the storage module comprises: the assembly module is used for combining and assembling a plurality of candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier; and the data cache module is used for storing the candidate service data object into the data cache region and taking the corresponding candidate service identifier as an index value of the candidate service data object.
In one embodiment, the data cache module is further configured to perform encoding processing on the candidate service data object to obtain an encoded candidate service data object, and store the encoded candidate service data object in the data cache region.
In one embodiment, the apparatus further comprises: a receiving module, configured to receive a data request, where the data request carries a target service identifier; a determining module, configured to determine a target index value corresponding to the target service identifier; the data acquisition module is used for acquiring target service data corresponding to the target index value from the data cache region according to the index relation; and the return module is used for returning the acquired target service data corresponding to the data request.
In one embodiment, the apparatus further comprises: the type judgment module is used for acquiring target service data corresponding to the target service identifier from the database according to the target service identifier when the service data corresponding to the data request is a type of service data; and when the service data corresponding to the data request is the second-class service data, informing a determining module to determine a target index value corresponding to the target service identifier.
In one embodiment, the first type of service data is real-time service data, and the second type of service data is non-real-time service data; the polling module is also used for acquiring a plurality of non-real-time service data corresponding to the candidate service identification from a plurality of databases through a polling process.
In one embodiment, the data request further carries a field identifier; the data obtaining module is further configured to obtain field data corresponding to the field identifier from the target service data, and use the field data as the target service data corresponding to the data request.
In one embodiment, the identifier obtaining module is further configured to obtain the candidate service identifier of the data to be cached by calling a data interface at preset time intervals.
In one embodiment, the apparatus further comprises: and the updating module is used for acquiring the updating service identification of which the data changes, acquiring corresponding updating service data from the plurality of databases according to the updating service identification when the polling process polls again, and updating the candidate service data in the data cache region according to the updating service data.
A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of:
acquiring a candidate service identifier of service data to be cached;
acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
storing the candidate service data into a data cache region, distributing an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
A computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of:
acquiring a candidate service identifier of service data to be cached;
acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
storing the candidate service data into a data cache region, distributing an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
According to the service data processing method, the device, the computer equipment and the storage medium, the candidate service identification of the service data to be cached is obtained, the candidate service data corresponding to the candidate service identification are extracted from the multiple databases according to the candidate service identification, then the candidate service data are stored in the data cache region, the index value is distributed to the candidate service data according to the candidate service identification, the index relation between the candidate service data and the index value is established, and the candidate service identification and the index value are in one-to-one correspondence relation. When a data request sent by the client is subsequently received, all target service data corresponding to the target service identification can be directly acquired from the data cache region at one time without acquiring the data from a plurality of databases one by one, so that the speed of returning the data is greatly improved, and the data delay is reduced. And the client can acquire a plurality of service data by only sending one request, thereby greatly reducing the interaction pressure between the client (terminal) and the server.
A method for processing service data, the method comprising:
receiving a data request, wherein the data request carries a target service identifier;
acquiring a target index value corresponding to the target service identifier;
acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region, and the candidate service data are extracted from a plurality of databases according to candidate service identifiers through a polling process;
and returning the acquired target service data corresponding to the data request.
In one embodiment, the candidate service data is stored in the data buffer by the following method: combining and assembling a plurality of candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier; and storing the candidate service data object in the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
In one embodiment, after receiving the data request, where the data request carries the target service identifier, the method further includes: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
A traffic data processing apparatus, the apparatus comprising:
the identification acquisition module is used for acquiring a candidate service identification of the service data to be cached;
the polling module is used for acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
the storage module is used for storing the candidate service data into a data cache region, allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
In one embodiment, the apparatus further comprises: the cache module is used for combining and assembling a plurality of candidate service data corresponding to the same candidate service identification according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification, storing the candidate service data object into the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
In one embodiment, the candidate service identifier is a candidate live broadcast identifier, and the candidate service data is live broadcast interaction state data; the target service data acquisition module is also used for acquiring a plurality of different types of live broadcast interactive state data corresponding to the target index value from a data cache region according to the target index value; the data return module is further used for returning the live broadcast interaction state data to a live broadcast watching terminal corresponding to the target live broadcast identification, so that the live broadcast interaction state data are displayed in different areas corresponding to the live broadcast watching terminal according to types.
In one embodiment, the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data; the target service data acquisition module is also used for acquiring a plurality of different types of candidate dynamic keyword information data corresponding to the target index value from a data cache region according to the target index value, wherein the candidate dynamic keyword information data are respectively extracted from a plurality of databases according to the heat of keywords; the data return module is also used for returning the dynamic keyword information data to the terminal corresponding to the candidate information set identification, so that a plurality of different types of candidate dynamic keyword information data are displayed in the information set in the terminal.
In one embodiment, the apparatus further comprises: the data type judging module is used for acquiring target service data corresponding to the target service identifier from the database according to the target service identifier when the service data corresponding to the data request is one type of service data; and when the service data corresponding to the data request is the second-class service data, informing an index value acquisition module to acquire a target index value corresponding to the target service identifier.
A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of:
receiving a data request, wherein the data request carries a target service identifier;
acquiring a target index value corresponding to the target service identifier;
acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region and extracted from a plurality of databases according to candidate service identifiers through a polling process;
and returning the obtained target service data corresponding to the data request.
A computer-readable storage medium storing a computer program which, when executed by a processor, causes the processor to perform the steps of:
receiving a data request, wherein the data request carries a target service identifier;
acquiring a target index value corresponding to the target service identifier;
acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region and extracted from a plurality of databases according to candidate service identifiers through a polling process;
and returning the acquired target service data corresponding to the data request.
According to the service data processing method, the service data processing device, the computer equipment and the storage medium, after the data request is received, the corresponding target index value is determined according to the target service identifier carried in the data request, then the corresponding target service data can be obtained from the data cache region according to the target index value, and then the corresponding target service data is returned. The candidate service data in the data cache region are extracted from a plurality of databases according to the candidate service identification through a polling process. According to the service data processing method, the data to be requested is stored in the data cache region in advance, after the data request is received, all target service data can be acquired at one time according to the target service identification, so that the time delay is small, and the pressure of a client (terminal) and a server is greatly reduced.
Drawings
FIG. 1 is a diagram of an application environment of a business data processing method in one embodiment;
FIG. 2 is a flow diagram of a method for processing business data in one embodiment;
FIG. 3 is a flow diagram of storing candidate service data in a data cache in one embodiment;
FIG. 4 is a flow chart illustrating a structure of a service data processing method according to an embodiment;
fig. 5 is a flowchart of a service data processing method in another embodiment;
FIG. 6 is a flow chart of a method for processing service data in yet another embodiment;
fig. 7 is a flowchart of a service data processing method in still another embodiment;
FIG. 8 is a diagram illustrating an interface for displaying different types of live interaction status data, according to an embodiment;
FIG. 9 is a diagram of an interface for presenting different types of dynamic keywords in a list, in one embodiment;
FIG. 10 is a flow diagram that illustrates the processing of business data in one embodiment;
fig. 11 is a flowchart of a service data processing method in a further embodiment;
FIG. 12 is a block diagram showing a configuration of a service data processing apparatus according to an embodiment;
FIG. 13 is a block diagram of the structure of a memory module in one embodiment;
fig. 14 is a block diagram showing a configuration of a service data processing apparatus according to another embodiment;
fig. 15 is a block diagram showing a configuration of a service data processing apparatus in still another embodiment;
fig. 16 is a block diagram showing a configuration of a service data processing apparatus according to still another embodiment;
fig. 17 is a block diagram showing a configuration of a service data processing apparatus according to still another embodiment;
fig. 18 is a block diagram showing the construction of a service data processing apparatus in a further embodiment;
FIG. 19 is a block diagram that illustrates the architecture of a computing device in one embodiment.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application is described in further detail below with reference to the accompanying drawings and embodiments. It should be understood that the specific embodiments described herein are merely illustrative of the present application and are not intended to limit the present application.
Fig. 1 is an application environment diagram of a service data processing method in an embodiment. Referring to fig. 1, the service data processing method is applied to a service data processing system. The service data processing system includes a terminal 110 and a server 120. The terminal 110 and the server 120 are connected through a network. The terminal 110 may be a desktop terminal or a mobile terminal, and the mobile terminal may be at least one of a mobile phone, a tablet computer, a notebook computer, and the like. The server 120 may be implemented as a stand-alone server or a server cluster comprising a plurality of servers. Specifically, the server 120 obtains a candidate service identifier of the service data to be cached, obtains a plurality of candidate service data corresponding to the candidate service identifier from a plurality of databases in a polling manner, stores the candidate service data in a data cache region, allocates an index value to the candidate service data according to the candidate service identifier corresponding to the candidate service data, and establishes an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in a one-to-one correspondence relationship. The terminal 110 sends a data request to the server 120, the data request carries a target service identifier, after receiving the data request, the server 120 obtains a target index value corresponding to the target service identifier, obtains target service data corresponding to the target index value from a data cache region according to the target index value, and returns the obtained target service data to the terminal 110.
As shown in fig. 2, in one embodiment, a service data processing method is provided. This embodiment is illustrated as applied to a server. The business data processing method specifically comprises the following steps:
step S202, obtaining candidate service identification of service data to be cached.
The candidate service identifier is an identifier corresponding to a service requiring data caching. The service identifier is used to uniquely identify a service. For example, in a live application scenario, the candidate service identifier is a live identifier (e.g., a live id) for uniquely identifying a live broadcast. The number of candidate service identifiers obtained here may be one or multiple. Specifically, when the server starts polling through a polling process, the server acquires a candidate service identifier of service data to be cached through calling a data interface.
Step S204, a plurality of candidate service data corresponding to the candidate service identification are obtained from a plurality of databases in a polling mode.
The polling function is to sequentially acquire a plurality of candidate service data corresponding to the candidate service identifier from a plurality of databases. The candidate service data refers to the acquired service data needing to be cached. Since a plurality of candidate service data corresponding to the candidate service identifier exist in a plurality of databases in a scattered manner, in order to acquire all candidate service data corresponding to the candidate service identifier, it is necessary to extract the candidate service data corresponding to the candidate service identifier from the plurality of databases in a polling manner. For example, it is assumed that there are 5 candidate service data corresponding to the candidate service identifier a, and the 5 candidate service data are dispersedly stored in 5 databases. In order to obtain 5 candidate service data corresponding to the candidate service identifier a, it is necessary to extract 5 candidate service data corresponding to the candidate service identifier from 5 databases, respectively.
In one embodiment, the candidate service data corresponding to the candidate service identifier may change over time, and when the candidate service data changes, the candidate service data corresponding to the candidate service identifier needs to be retrieved from the multiple databases. For example, in a live application scenario, data such as the number of viewers, the number of online viewers, and the number of gifts are constantly changing, and when the data changes, candidate service data corresponding to a live broadcast identifier needs to be obtained from the database again. In order to adapt to the situation that the data is constantly changing, in one embodiment, polling is performed again at preset time intervals (e.g., 1 second), that is, candidate service data corresponding to the candidate service identifier is obtained again and stored in the data buffer. In another embodiment, when a data change is detected, the polling of the candidate service data corresponding to the candidate service identifier may be restarted.
Step S206, storing the candidate service data in a data cache region, allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in a one-to-one correspondence relationship.
The data buffer area refers to a storage space for buffering service data. Specifically, a data cache region for caching the service data may be created in the memory of the server. In one embodiment, a shared memory is used as a data cache. And storing the acquired candidate service data corresponding to the candidate service identification in a data cache region, and allocating the same index value to the candidate service data corresponding to the same candidate service identification in order to search the candidate service data corresponding to the same candidate service identification from the data cache region according to one index value. Specifically, in the process of allocating the index value, the index value is allocated to the candidate service data according to the candidate service identifier corresponding to the candidate service data, and an index relationship between the index value and the candidate service data and a corresponding relationship between the index value and the candidate service identifier are established, wherein the candidate service identifier and the index value are in a one-to-one correspondence relationship.
The creation of the index value may be set by a user, and in an embodiment, the index value corresponding to the candidate service identifier may be determined according to a preset rule, for example, a prefix may be uniformly added on the basis of the candidate service identifier to serve as the index value corresponding to the candidate service identifier, or an index value may be randomly allocated to each candidate service identifier, and then a one-to-one correspondence relationship between the index value and the candidate service identifier is established. In another embodiment, the candidate service data identifier may also be directly used as an index value, and since conversion between the candidate service identifier and the index value is not required, the corresponding candidate service data may be directly searched from the data cache region subsequently according to the candidate service data identifier, thereby further improving the speed of data return.
By storing a plurality of candidate service data corresponding to the candidate service identification in the data buffer area in advance, the delay of subsequent request data is reduced. After the candidate service data corresponding to the candidate service identification are stored in the data cache region, the same index value is distributed to the candidate service data corresponding to the same candidate service identification, so that the original client can acquire the service data only by requesting for many times, and the service data can be acquired only by sending a request once, thereby greatly reducing the interaction pressure between the client and the server and improving the concurrence of the server for processing the request. For example, suppose that three data, namely the number of online people, the number of watching people, and the number of gift sending people, are requested when a live video is opened, and the number of online people, the number of watching people, and the number of gift sending people are respectively stored in 3 different background servers, so that a request needs to be sent to each background server, that is, 3 requests need to be sent.
The business data processing method comprises the steps of obtaining candidate business identifications of business data to be cached, extracting a plurality of candidate business data corresponding to the candidate business identifications from a plurality of databases according to the candidate business identifications, then storing the candidate business data into a data cache region, distributing index values for the candidate business data according to the candidate business identifications, establishing index relationships between the candidate business data and the index values, and enabling the candidate business identifications and the index values to be in one-to-one correspondence. When a data request sent by the client is subsequently received, all target service data corresponding to the target service identification can be directly acquired from the data cache region at one time without acquiring the data from a plurality of databases one by one, so that the data return speed is greatly improved, and the data delay is reduced. And the client can acquire a plurality of service data by only sending one request, thereby greatly reducing the interaction pressure between the client (terminal) and the server.
As shown in fig. 3, in an embodiment, the step of storing the candidate service data in the data buffer, and allocating an index value to the candidate service data according to the candidate service identifier corresponding to the candidate service data includes:
step S206A, a plurality of candidate service data corresponding to the same candidate service identification are combined and assembled according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification.
The candidate service data object refers to a data set which is composed of a plurality of candidate service data and corresponds to the same candidate service identifier. In one embodiment, each candidate service data corresponds to a corresponding field identifier, a combination sequence between field data corresponding to each field identifier is preset, and after the candidate service data (i.e., the field data) corresponding to each field identifier is obtained, the candidate service data is combined according to the predefined combination sequence to obtain a corresponding candidate service data object. For example, it is assumed that a data protocol structure defines a combination of 10 field data and a combination sequence of 10 field data, where each field data corresponds to a unique field identifier, and after candidate service data corresponding to the candidate service identifier is obtained, a plurality of candidate service data are assembled and combined according to the field identifier corresponding to the candidate service data, and the obtained candidate combined data is referred to as a "candidate service data object". In one embodiment, a data Protocol structure defined by a Protocol Buffer Protocol may be adopted, a data Protocol structure defined by a JCE Protocol may also be adopted, and of course, other protocols may also be used. The protocol refers to rules and conventions for realizing information exchange and negotiation between two terminals in a cooperative work. For example, specifying the respective field type, what compression algorithm or encryption algorithm to use, etc.
The multiple candidate service data corresponding to the same candidate service identifier are combined and assembled, so that the target service data object corresponding to the target service data identifier can be directly obtained from the data cache region in the follow-up process, and the data return speed can be increased.
Step S206B, storing the candidate service data object in a data cache region, and taking the corresponding candidate service identification as the index value of the candidate service data object.
The candidate service data objects obtained by combination are stored in a data cache region, and corresponding index values are distributed to the candidate service data, so that subsequent query can be conveniently carried out according to the index values. In order to quickly query, the corresponding candidate service data identification is directly used as the index value of the candidate service data object, so that when the target service identification contained in the data request is subsequently acquired, the corresponding target service data object can be quickly acquired from the data cache region directly according to the target service identification without conversion between the candidate service identification and the index value, and the speed of data return is further improved.
In one embodiment, the step of storing the candidate business data object to the data cache comprises: and coding the candidate service data object to obtain a coded candidate service data object, and storing the coded candidate service data object in a data cache region.
For convenience of subsequent data transmission, after a plurality of candidate service data corresponding to the same candidate service identifier are assembled and combined to obtain a candidate service data object, data coding (serialization) needs to be performed on the candidate service data object, so that the purpose of compressing the candidate service data object is achieved, and the transmission speed of subsequent data is increased conveniently. In one embodiment, the candidate business data object may be converted into data in binary form and stored in a data cache.
Fig. 4 is a schematic structural flow diagram of a service data processing method in an embodiment, where the service data processing method includes a unified polling process, a data cache region, and a background service. The method comprises the steps that a unified polling process is independently set for obtaining candidate service data from a plurality of databases, and a shared memory cache region is used as a data cache region for storing the obtained candidate service data. The background service is used for directly interacting with the client. Specifically, before a background service receives a data request, a unified polling process acquires candidate service identifiers of service data to be cached by calling a data interface, then uniformly acquires a plurality of candidate service identifiers corresponding to the candidate service identifiers from each database in a polling mode, combines and assembles the candidate service identifiers corresponding to the same candidate service identifier to obtain candidate service data objects, serializes (encodes) the candidate service data objects to obtain encoded candidate service data objects, stores the encoded candidate service data objects in a shared memory cache area, takes the corresponding candidate service identifiers as index values of the encoded candidate service data objects, and establishes an index relationship between the index values and the candidate service data objects. And after receiving a data request sent by the front end through the background service, searching a corresponding target service data object from the shared memory cache region according to a target service identifier in the data request, and then returning the target service data object.
As shown in fig. 5, in an embodiment, the service data processing method further includes:
step S208, a data request is received, and the data request carries a target service identifier.
The target service identifier is a service identifier corresponding to the currently requested service data. Specifically, the terminal may send a data request to the server through a client installed in the terminal, where the client may be an APP (Application) installed in the terminal, a Web end, an applet, or the like.
In one embodiment, the target service identifier in the data request sent by the terminal is serialized (encoded), so that after receiving the data request, the server needs to analyze the data request, that is, perform deserialization (decoding), to obtain the target service identifier carried in the data request.
Step S210, determining a target index value corresponding to the target service identifier.
The target index value refers to an index value corresponding to the target service identifier. Because the one-to-one corresponding relation between the candidate service identification and the index value is established in advance, the corresponding target index value can be determined according to the target service identification.
Step S212, obtaining the target service data corresponding to the target index value from the data cache region according to the index relationship.
The index relation between the index value and the candidate service data is pre-established, and after the target index value is obtained, the target service data corresponding to the target index value can be searched from the data cache region according to the established index relation.
And step S214, returning the acquired target service data corresponding to the data request.
The target service data refers to the searched service data corresponding to the data request, and after the target service data is obtained, the target service data can be returned to the terminal so as to display the corresponding data in the terminal.
In one embodiment, after the step of receiving a data request carrying a target service identifier, the method further includes: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, the step of determining the target index value corresponding to the target service identifier is carried out.
The service data is classified into first-class service data and second-class service data in advance. The division of the first-class service data and the second-class service data can be set by self-definition according to actual conditions. For example, data with a relatively high requirement on real-time performance may be used as a type of service data, and since the requirement on real-time performance is relatively high, target service data corresponding to the target service identifier is acquired from the database in real time. The data with low real-time requirement can be used as the second class of service data, for the data, the data can be firstly cached in a data cache region, and when a data request is received, the target service data corresponding to the target service identifier is obtained from the data cache region, so that the time delay of the data can be reduced, the data return speed is improved, and the interaction pressure between the terminal and the server is reduced. In another embodiment, dynamic data may be used as one type of service data, and static data may be used as two types of service data, where dynamic data refers to data that may change over time; static data refers to data that does not change over time.
In one embodiment, the first type of service data is real-time service data, and the second type of service data is non-real-time service data; the step of acquiring a plurality of candidate service data corresponding to the candidate service identifier from a plurality of databases in a polling manner includes: and acquiring a plurality of non-real-time service data corresponding to the candidate service identification from a plurality of databases through a polling process.
The service data is divided into real-time service data and non-real-time service data, the real-time service data is used as first-class service data, and the non-real-time service data is used as second-class service data. Since real-time service data has a high requirement on real-time performance, corresponding data needs to be directly acquired from a database. And for the non-real-time service data, acquiring a plurality of non-real-time service data corresponding to the candidate service identifiers from a plurality of databases through a polling process in advance, then storing the plurality of non-real-time service data into a data cache region, and after a user request is subsequently received, acquiring target service data corresponding to the target service identifiers from the data cache region when the requested data is second-class service data.
In one embodiment, the data request further carries a field identifier; the step of acquiring the target service data corresponding to the target index value from the data cache region according to the index relationship comprises the following steps: and acquiring field data corresponding to the field identification from the target service data, and taking the field data as the target service data corresponding to the data request.
Wherein the field identification is used to uniquely identify a field. When the client only needs to acquire field data corresponding to one or more field identifiers (that is, all field data corresponding to the candidate service identifiers do not need to be acquired), the field identifiers are carried in the data request, the field data corresponding to the field identifiers are acquired from the acquired target service data according to the field identifiers, and then only the field data serving as the target service data corresponding to the data request is returned. For example, assuming that a plurality of field data corresponding to the same candidate service identifier are stored in the data cache region, assuming that the data cache region includes four field data, i.e., a, B, C, and D, and at this time, the front end only needs to acquire the field data a, then the corresponding field data a may be acquired from the target service data according to the field identifier corresponding to the field data a, and then the data field a is returned to the client as the target service data.
In one embodiment, the step of obtaining the candidate service identifier of the data to be cached includes: and acquiring the candidate service identification of the data to be cached by calling a data interface at preset time intervals.
Since the service data may change frequently, the polling process needs to re-acquire the candidate service identifier of the data to be cached at preset time intervals (for example, 1 s), then acquire corresponding candidate service data from the database according to the candidate service identifier, and then store the candidate service data in the data cache region according to the method in the above embodiment.
As shown in fig. 6, in an embodiment, the service data processing method further includes:
step S216, obtain the update service identifier with changed data.
The update service identifier refers to an identifier corresponding to a service whose service data changes. The updated service identifier includes two kinds, one is a new service identifier, that is, the service identifier does not exist originally, and the service identifier is an identifier of the new service. One is an original service identifier with data change, i.e. an original existing service identifier, but the service data corresponding to the service identifier has a change. Specifically, the polling process acquires a service identifier whose data changes at preset time intervals, and for distinguishing, the service identifier is called "update service identifier".
Step S218, when the polling process polls again, corresponding updated service data is obtained from the multiple databases according to the updated service identifier, and the candidate service data in the data cache area is updated according to the updated service data.
After the update service identifier is obtained, when the polling process starts polling again, corresponding update service data is obtained from the multiple databases according to the update service identifier, when the update service data is newly added service data, the update service data is stored in a data cache region, an index value is distributed to the update service data, and a corresponding relation between the index value and the update service identifier is established; and when the updated service data is the original service identifier of which the data is changed, replacing the candidate service data corresponding to the updated service identifier in the data cache region with the updated service data. For example, assume that the candidate service data obtained by the first polling is identified by a, B, and C. The candidate service data identifiers obtained before the polling is started for the second time are a, C and D. And A and C are service identifications existing before, but the corresponding data are changed, so that after the updated service data corresponding to A and C are obtained, the corresponding original service data in the data cache region are replaced by the updated service data. And D is the newly added service identifier, so the updated service data corresponding to D is directly stored in the data cache region, and an index value is allocated. In addition, the data cached in the data cache region has timeliness, and when the stay time of the data in the cache exceeds the preset cache time, the data can be automatically cleared, so that the corresponding storage space is released. The buffering time can be set in a user-defined manner according to actual conditions, for example, the buffering time can be set to 5 minutes.
As shown in fig. 7, in an embodiment, another service data processing method is provided, where the method includes:
step S702, receiving a data request, where the data request carries a target service identifier.
The service identifier is used for identifying a service, and the target service identifier is a service identifier corresponding to service data to be requested. After receiving the data request, the server firstly analyzes the data request to obtain a target service identifier contained in the data request. Specifically, when the client sends a request, it sends a request structure, which is a serialized structure. The background server receives the data request, deserializes the request structure and acquires the target service identifier from the request structure.
Step S704, a target index value corresponding to the target service identifier is obtained.
The index value is used for searching corresponding target service data from the data cache region. The server stores the one-to-one correspondence between the index value and the candidate service identifier, and after the target service identifier is obtained, the target index value corresponding to the target service identifier can be determined.
Step S706, acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region, and the candidate service data are extracted from a plurality of databases according to candidate service identifiers through a polling process.
Candidate service data are stored in a data cache region in advance, and the candidate service data are extracted from a plurality of databases according to candidate service identifications through a polling process. And acquiring the target service data corresponding to the target index value from the data cache region according to the target index value.
And step S708, returning the acquired target service data corresponding to the data request.
The target service data refers to the searched service data corresponding to the data request, and after the target service data is obtained, the target service data can be returned to the terminal so as to display the corresponding data in the terminal.
After receiving the data request, the service data processing method determines a corresponding target index value according to a target service identifier carried in the data request, then acquires corresponding target service data from the data cache region according to the target index value, and then returns the corresponding target service data. And candidate service data in the data cache region are extracted from a plurality of databases according to the candidate service identification through a polling process. According to the service data processing method, the data to be requested is stored in the data cache region in advance, after the data request is received, all target service data can be acquired at one time according to the target service identification, so that the time delay is small, and the pressure of a client (terminal) and a server is greatly reduced.
In one embodiment, the candidate service data is stored in the data buffer by the following method: combining and assembling a plurality of candidate service data corresponding to the same candidate service identification according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification; and storing the candidate service data object into a data cache region, and taking the corresponding candidate service identifier as an index value of the candidate service data object.
After a plurality of candidate service data are extracted from a plurality of databases according to the candidate service identification, a plurality of candidate service data corresponding to the same candidate service identification are assembled according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification, then the candidate service data object is stored in a data cache region, and the candidate service identification is used as an index value of the candidate service data object, so that the corresponding candidate service data can be directly obtained from the data cache region according to the candidate service identification in the follow-up process. In an embodiment, after the candidate service data objects are obtained by splicing, in order to facilitate transmission, the candidate service data objects need to be serialized (i.e., coded) to obtain coded candidate service data objects (for example, the coded candidate service data objects may be coded as candidate service data objects existing in a binary form). Similarly, when the terminal receives the encoded candidate service data, it needs to perform deserialization (i.e., decoding) on the candidate service data to obtain specific candidate service data.
In one embodiment, the client and the background service predefine a data transfer protocol. The protocol includes two constructs, one a request construct and one a response construct. When a client sends a data Request, it sends a Request structure (Request), which is a structure after being serialized. After receiving the data request, the background server performs deserialization on the request structure to obtain a target service identifier from the request structure, and then obtains a corresponding Response structure (Response) from the data cache region according to the target service identifier, where the Response structure in the data cache region is a serialized Response structure, the Response structure stores target service data corresponding to the target service identifier, and the Response structure, that is, the data protocol structure mentioned in the above embodiment, returns the serialized Response structure to the client. And after receiving the response data, the client performs deserialization to obtain target service data in the response structure. In a live application scenario, a live id may be used as a service identifier, and assuming that live data corresponding to the live id includes an online number of people and a watching number of people, codes of a corresponding request structure and a corresponding response structure may be represented as follows:
// Request structure Request {0 optional string id; };
// Response structure Response {0 require ERrCode; // Return code
1 optional int onlinensumber; // online person 2 optional int playNumber; // number of viewers }.
In one embodiment, the candidate service identifier is a candidate live broadcast identifier, and the candidate service data is live broadcast interaction state data; the step of acquiring the target service data corresponding to the target index value from the data cache region according to the target index value comprises the following steps: acquiring a plurality of different types of live broadcast interaction state data corresponding to the target index value from a data cache region according to the target index value; the step of returning the acquired target service data corresponding to the data request comprises: and returning the live broadcast interaction state data to a live broadcast watching terminal corresponding to the target live broadcast identification, so that the live broadcast interaction state data are displayed in different areas corresponding to the live broadcast watching terminal according to types.
In a live service scene, the candidate service identifier is a candidate live identifier (for example, live id), and the candidate service data is live interaction state data. The live broadcast interactive state data comprises a plurality of dynamically changed data of different types, such as audience number, online number, popularity value, property sending number, praise number and the like. Specifically, a plurality of different types of live broadcast interaction state data are used as data corresponding to one service in advance according to actual needs, that is, the plurality of different types of live broadcast interaction state data correspond to the same request, so that the plurality of different types of live broadcast interaction state data can be directly returned to the terminal upon receiving the request, and after the terminal receives the plurality of different types of live broadcast interaction state data, the live broadcast interaction state data are respectively displayed in different areas corresponding to the live broadcast watching terminal according to types, as shown in fig. 8, the method is an interface schematic diagram in which different types of live broadcast interaction state data are displayed in the live broadcast watching terminal in one embodiment.
In one embodiment, the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data; the acquiring, from a data cache region according to the target index value, target service data corresponding to the target index value includes: acquiring a plurality of different types of dynamic keyword information data corresponding to the target index value from a data cache region according to the target index value, wherein the dynamic keyword information data are respectively extracted from a plurality of databases according to the heat of keywords; the returning of the obtained target service data corresponding to the data request includes: and returning the dynamic keyword information data to the terminal corresponding to the target information set identifier so as to display a plurality of different types of dynamic keyword information data in the information set in the terminal.
In the information display service scene, the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data. The candidate information set identifier is used for identifying a candidate information set, and the candidate information set comprises a plurality of different types of dynamic keywords. The dynamic keyword information data refers to keywords of a certain hotspot event, and the dynamic keywords are continuously changed along with the change of the hotspot event. In order to facilitate people to quickly know the current hot events in different fields, keywords corresponding to the hot events in different fields are displayed in an information list (namely, in an information set) on a home page of information display, and the corresponding keywords also need to be changed along with the change of the hot events. The information list includes different types of dynamic keyword information data, for example, various types of keywords including financial, sports, time keeping, entertainment, movies, and the like. Different types of dynamic keyword information data are respectively stored in different databases, in order to quickly show dynamic keywords corresponding to different types for a user, different types of dynamic keyword information data corresponding to the candidate information set identification are extracted from each database in advance according to the candidate information set identification, and the dynamic keyword information data are extracted according to the heat degree of the keywords when being extracted from the database, for example, the keyword with the highest heat degree in the same type can be taken as the keyword extracted to correspond to the type. And then storing the extracted different types of dynamic keyword information data into a data cache region. Subsequently, when a request sent by the terminal is received, the corresponding multiple different types of dynamic keyword information data are obtained from the data cache region according to the target information contained in the request and the identifier, and then the data are returned to the terminal, and the terminal displays the multiple different types of dynamic keyword information data in an information list in the terminal, as shown in fig. 9, which is an interface schematic diagram in which the different types of dynamic keyword information data are displayed in the information list in one embodiment.
In one embodiment, after the step of receiving a data request, where the data request carries a target service identifier, the method further includes: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
The service data is classified into first-class service data and second-class service data in advance. The division of the first-class service data and the second-class service data can be set by self-definition according to actual conditions. For example, data with a relatively high requirement on real-time performance may be used as a type of service data, and since the requirement on real-time performance is relatively high, target service data corresponding to the target service identifier is acquired from the database in real time. The data with low real-time requirement can be used as the second class of service data, for the data, the data can be firstly cached in a data cache region, and when a data request is received, the target service data corresponding to the target service identifier is obtained from the data cache region, so that the time delay of the data can be reduced, the data return speed is improved, and the interaction pressure between the terminal and the server is reduced.
Fig. 10 is a schematic flow chart illustrating service data processing in an embodiment. Firstly, a unified polling process acquires candidate service identifications of service data to be cached at preset time intervals, acquires a plurality of candidate service data corresponding to the candidate service identifications from a plurality of databases according to the candidate service identifications, assembles and combines the candidate service data corresponding to the same candidate service identification according to a predefined data protocol structure to obtain candidate service data objects, serializes the candidate service data objects according to a protocol, stores the serialized candidate service data objects in a data cache region, and takes the candidate service identifications as index values (key values). And then, receiving a data request sent by the client, analyzing the data request to obtain a target service identifier carried in the request, obtaining a corresponding target service data object from the data cache region according to the target service identifier, returning the target service data object to the client, and performing deserialization on the obtained target service data object by the client to obtain the target service data object.
As shown in fig. 11, in an embodiment, a method for processing service data is provided, which specifically includes the following steps:
and step S1101, acquiring a candidate service identifier of the data to be cached by calling a data interface at preset time intervals.
Step S1102, obtaining multiple candidate service data corresponding to the candidate service identifier from multiple databases in a polling manner.
Step S1103, combining and assembling a plurality of candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier.
Step S1104, storing the candidate service data object in the data cache region, and using the corresponding candidate service identifier as an index value of the candidate service data object, where the candidate service identifier and the index value are in a one-to-one correspondence relationship.
Step S1105, receiving a data request, where the data request carries a target service identifier.
Step S1106, determining whether the service data corresponding to the data request is a class ii service data, if yes, going to step S1108, and if not, going to step S1107.
Step S1107, acquiring, from the database, target service data corresponding to the target service identifier according to the target service identifier.
Step S1108, determining a target index value corresponding to the target service identifier.
Step S1109, obtaining target service data corresponding to the target index value from the data cache region according to the index relation;
step S1110, return the acquired target service data corresponding to the data request.
As shown in fig. 12, in one embodiment, a service data processing apparatus is provided, which includes:
the identifier obtaining module 1202 is configured to obtain a candidate service identifier of service data to be cached.
And the polling module 1204 is configured to acquire, in a polling manner, multiple candidate service data corresponding to the candidate service identifier from multiple databases.
A storing module 1206, configured to store the candidate service data in a data cache region, allocate an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establish an index relationship between the candidate service data and the index value, where the candidate service identifier and the index value are in a one-to-one correspondence relationship.
As shown in FIG. 13, in one embodiment, the storage module 1206 comprises:
the assembling module 1206A is configured to assemble a plurality of candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier.
The data caching module 1206B is configured to store the candidate service data object in the data caching area, and use the corresponding candidate service identifier as an index value of the candidate service data object.
In an embodiment, the data cache module is further configured to perform encoding processing on the candidate service data object to obtain an encoded candidate service data object, and store the encoded candidate service data object in the data cache region.
As shown in fig. 14, in an embodiment, the service data processing apparatus further includes:
a receiving module 1208, configured to receive a data request, where the data request carries a target service identifier.
A determining module 1210, configured to determine a target index value corresponding to the target service identifier.
A data obtaining module 1212, configured to obtain, according to the index relationship, target service data corresponding to the target index value from the data cache region.
A returning module 1214, configured to return the obtained target service data corresponding to the data request.
As shown in fig. 15, in an embodiment, the service data processing apparatus further includes:
a type determining module 1209, configured to, when the service data corresponding to the data request is a type of service data, obtain, according to the target service identifier, target service data corresponding to the target service identifier from the database; and when the service data corresponding to the data request is the second-class service data, informing a determining module to determine a target index value corresponding to the target service identifier.
In one embodiment, the first type of service data is real-time service data, and the second type of service data is non-real-time service data; the polling module is further configured to obtain, through a polling process, a plurality of non-real-time service data corresponding to the candidate service identifier from a plurality of databases.
In one embodiment, the data request further carries a field identifier; the data obtaining module is further configured to obtain field data corresponding to the field identifier from the target service data, and use the field data as the target service data corresponding to the data request.
In an embodiment, the identifier obtaining module is further configured to obtain the candidate service identifier of the data to be cached by calling a data interface at preset time intervals.
As shown in fig. 16, in an embodiment, the service data processing apparatus further includes:
an updating module 1216, configured to obtain an update service identifier indicating that data changes, and when the polling process polls again, obtain corresponding update service data from multiple databases according to the update service identifier, and update candidate service data in the data cache area according to the update service data.
As shown in fig. 17, in one embodiment, a service data processing apparatus is provided, which includes:
a request receiving module 1702, configured to receive a data request, where the data request carries a target service identifier.
An index value obtaining module 1704 is configured to obtain a target index value corresponding to the target service identifier.
A target service data obtaining module 1706, configured to obtain, according to the target index value, target service data corresponding to the target index value from a data cache region, where candidate service data is stored in the data cache region, where the candidate service data is extracted from multiple databases according to candidate service identifiers through a polling process.
And a data returning module 1708, configured to return the obtained target service data corresponding to the data request.
As shown in fig. 18, in an embodiment, the service data processing apparatus further includes:
the cache module 1701 is configured to combine and assemble multiple candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier, store the candidate service data object in the data cache region, and use the corresponding candidate service identifier as an index value of the candidate service data object.
In one embodiment, the candidate service identifier is a candidate live broadcast identifier, and the candidate service data is live broadcast interaction state data; the target service data acquisition module is also used for acquiring a plurality of different types of live broadcast interactive state data corresponding to the target index value from a data cache region according to the target index value; the data return module is further used for returning the live broadcast interaction state data to a live broadcast watching terminal corresponding to the target live broadcast identification, so that the live broadcast interaction state data are displayed in different areas corresponding to the live broadcast watching terminal according to types.
In one embodiment, the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data; the target service data acquisition module is also used for acquiring a plurality of different types of candidate dynamic keyword information data corresponding to the target index value from a data cache region according to the target index value, wherein the candidate dynamic keyword information data are respectively extracted from a plurality of databases according to the heat of keywords; the data returning module is also used for returning the dynamic keyword information data to the terminal corresponding to the candidate information set identification so as to display the candidate dynamic keyword information data of different types in the information set in the terminal.
In one embodiment, the service data processing apparatus further includes:
the data type judging module is used for acquiring target service data corresponding to the target service identifier from the database according to the target service identifier when the service data corresponding to the data request is one type of service data; and when the service data corresponding to the data request is the second-class service data, informing an index value acquisition module to acquire a target index value corresponding to the target service identifier.
FIG. 19 is a diagram showing an internal structure of a computer device in one embodiment. The computer device may specifically be a server. As shown in fig. 19, the computer apparatus includes a processor, a memory, and a network interface connected by a system bus. Wherein the memory includes a non-volatile storage medium and an internal memory. The non-volatile storage medium of the computer device stores an operating system and may also store a computer program that, when executed by the processor, causes the processor to implement the service data processing method. The internal memory may also have stored therein a computer program that, when executed by the processor, causes the processor to perform the business data processing method. Those skilled in the art will appreciate that the architecture shown in fig. 19 is merely a block diagram of some of the structures associated with the disclosed aspects and is not intended to limit the computing devices to which the disclosed aspects apply, as particular computing devices may include more or less components than those shown, or may combine certain components, or have a different arrangement of components.
In one embodiment, the service data processing method provided by the present application may be implemented in the form of a computer program, and the computer program may be run on a computer device as shown in fig. 19. The memory of the computer device may store various program modules constituting the service data processing apparatus, such as an identification obtaining module 1202, a polling module 1204, and a storage module 1206 of fig. 12. The computer program constituted by the respective program modules causes the processor to execute the steps in the business data processing apparatus of the respective embodiments of the present application described in the present specification. For example, the computer device shown in fig. 19 may obtain, by the identifier obtaining module 1202 of the service data processing apparatus shown in fig. 12, candidate service identifiers of service data to be cached, and obtain, by the polling module 1204, a plurality of candidate service data corresponding to the candidate service identifiers from a plurality of databases in a polling manner; the candidate service data is stored in a data cache region through a storage module 1206, an index value is allocated to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and an index relationship between the candidate service data and the index value is established, wherein the candidate service identifier and the index value are in one-to-one correspondence.
In one embodiment, a computer device is proposed, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of: acquiring a candidate service identifier of service data to be cached; acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode; storing the candidate service data into a data cache region, distributing an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
In one embodiment, storing the candidate service data in a data buffer, and allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data includes: combining and assembling a plurality of candidate service data corresponding to the same candidate service identification according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification; and storing the candidate service data object in the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
In one embodiment, said storing said candidate business data object to said data cache region comprises: and coding the candidate service data object to obtain a coded candidate service data object, and storing the coded candidate service data object in the data cache region.
In one embodiment, the computer program further causes the processor to perform the steps of: receiving a data request, wherein the data request carries a target service identifier; determining a target index value corresponding to the target service identifier; acquiring target service data corresponding to the target index value from the data cache region according to the index relation; and returning the obtained target service data corresponding to the data request.
In one embodiment, after receiving the data request, where the data request carries a target service identifier, the computer program further causes the processor to perform the following steps: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
In one embodiment, the first type of service data is real-time service data, and the second type of service data is non-real-time service data; the acquiring, by means of polling, a plurality of candidate service data corresponding to the candidate service identifier from a plurality of databases includes: and acquiring a plurality of non-real-time service data corresponding to the candidate service identification from a plurality of databases through a polling process.
In one embodiment, the data request further carries a field identifier; the obtaining of the target service data corresponding to the target index value from the data cache region according to the index relationship includes: and acquiring field data corresponding to the field identification from the target service data, and taking the field data as the target service data corresponding to the data request.
In an embodiment, the obtaining the candidate service identifier of the data to be cached includes: and acquiring the candidate service identification of the data to be cached by calling a data interface at preset time intervals.
In one embodiment, the computer program further causes the processor to perform the steps of: acquiring an update service identifier of which the data changes; and when the polling process polls again, acquiring corresponding updated service data from a plurality of databases according to the updated service identification, and updating the candidate service data in the data cache region according to the updated service data.
In an embodiment, a computer device is proposed, comprising a memory and a processor, the memory storing a computer program which, when executed by the processor, causes the processor to perform the steps of: receiving a data request, wherein the data request carries a target service identifier; acquiring a target index value corresponding to the target service identifier; acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region and extracted from a plurality of databases according to candidate service identifiers through a polling process; and returning the obtained target service data corresponding to the data request.
In one embodiment, the candidate service data is stored in the data buffer by: combining and assembling a plurality of candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier; and storing the candidate service data object in the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
In one embodiment, the candidate service identifier is a candidate live broadcast identifier, and the candidate service data is live broadcast interaction state data; the acquiring, from a data cache region according to the target index value, target service data corresponding to the target index value includes: acquiring a plurality of different types of live broadcast interaction state data corresponding to the target index value from a data cache region according to the target index value; the returning of the obtained target service data corresponding to the data request includes: and returning the live broadcast interactive state data to a live broadcast watching terminal corresponding to the target live broadcast identification, so that the live broadcast interactive state data are displayed in different areas corresponding to the live broadcast watching terminal according to types.
In one embodiment, the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data; the acquiring, from a data cache region according to the target index value, target service data corresponding to the target index value includes: acquiring a plurality of different types of dynamic keyword information data corresponding to the target index value from a data cache region according to the target index value, wherein the dynamic keyword information data are respectively extracted from a plurality of databases according to the heat of keywords; the returning of the obtained target service data corresponding to the data request includes: and returning the dynamic keyword information data to the terminal corresponding to the target information set identifier so as to display the dynamic keyword information data of different types in the information set in the terminal.
In one embodiment, after receiving the data request, where the data request carries a target service identifier, the computer program further causes the processor to perform the following steps: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
In one embodiment, a computer-readable storage medium is proposed, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the steps of: acquiring a candidate service identifier of service data to be cached; acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode; storing the candidate service data into a data cache region, distributing an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
In one embodiment, storing the candidate service data in a data buffer, and allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data includes: combining and assembling a plurality of candidate service data corresponding to the same candidate service identification according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification; and storing the candidate service data object in the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
In one embodiment, the storing the candidate business data object to the data cache comprises: and coding the candidate service data object to obtain a coded candidate service data object, and storing the coded candidate service data object in the data cache region.
In one embodiment, the computer program further causes the processor to perform the steps of: receiving a data request, wherein the data request carries a target service identifier; determining a target index value corresponding to the target service identifier; acquiring target service data corresponding to the target index value from the data cache region according to the index relation; and returning the acquired target service data corresponding to the data request.
In one embodiment, after receiving the data request, where the data request carries a target service identifier, the computer program further causes the processor to perform the following steps: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
In one embodiment, the first type of service data is real-time service data, and the second type of service data is non-real-time service data; the acquiring, by means of polling, a plurality of candidate service data corresponding to the candidate service identifier from a plurality of databases includes: and acquiring a plurality of non-real-time service data corresponding to the candidate service identification from a plurality of databases through a polling process.
In one embodiment, the data request further carries a field identifier; the obtaining of the target service data corresponding to the target index value from the data cache area according to the index relationship includes: and acquiring field data corresponding to the field identification from the target service data, and taking the field data as the target service data corresponding to the data request.
In an embodiment, the obtaining the candidate service identifier of the data to be cached includes: and acquiring the candidate service identification of the data to be cached by calling a data interface at preset time intervals.
In one embodiment, the computer program further causes the processor to perform the steps of: acquiring an update service identifier of which data is changed; and when the polling process polls again, acquiring corresponding updated service data from a plurality of databases according to the updated service identification, and updating the candidate service data in the data cache region according to the updated service data.
In one embodiment, a computer-readable storage medium is proposed, in which a computer program is stored which, when executed by a processor, causes the processor to carry out the steps of: receiving a data request, wherein the data request carries a target service identifier; acquiring a target index value corresponding to the target service identifier; acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region and extracted from a plurality of databases according to candidate service identifiers through a polling process; and returning the acquired target service data corresponding to the data request.
In one embodiment, the candidate service data is stored in the data buffer by: combining and assembling a plurality of candidate service data corresponding to the same candidate service identification according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identification; and storing the candidate service data object in the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
In one embodiment, the candidate service identifier is a candidate live broadcast identifier, and the candidate service data is live broadcast interaction state data; the acquiring, from a data cache region according to the target index value, target service data corresponding to the target index value includes: acquiring a plurality of different types of live broadcast interaction state data corresponding to the target index value from a data cache region according to the target index value; the returning of the obtained target service data corresponding to the data request includes: and returning the live broadcast interactive state data to a live broadcast watching terminal corresponding to the target live broadcast identification, so that the live broadcast interactive state data are displayed in different areas corresponding to the live broadcast watching terminal according to types.
In one embodiment, the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data; the obtaining of the target service data corresponding to the target index value from the data cache area according to the target index value includes: acquiring a plurality of different types of dynamic keyword information data corresponding to the target index value from a data cache region according to the target index value, wherein the dynamic keyword information data are respectively extracted from a plurality of databases according to the heat of keywords; the returning of the obtained target service data corresponding to the data request includes: and returning the dynamic keyword information data to the terminal corresponding to the target information set identifier so as to display a plurality of different types of dynamic keyword information data in the information set in the terminal.
In one embodiment, after receiving the data request, where the data request carries a target service identifier, the computer program further causes the processor to perform the following steps: when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier; and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
It will be understood by those skilled in the art that all or part of the processes of the methods of the embodiments described above may be implemented by a computer program, which may be stored in a non-volatile computer readable storage medium, and when executed, may include the processes of the embodiments of the methods described above. Any reference to memory, storage, database, or other medium used in the embodiments provided herein may include non-volatile and/or volatile memory, among others. Non-volatile memory can include read-only memory (ROM), programmable ROM (PROM), electrically Programmable ROM (EPROM), electrically Erasable Programmable ROM (EEPROM), or flash memory. Volatile memory can include Random Access Memory (RAM) or external cache memory. By way of illustration and not limitation, RAM is available in a variety of forms such as Static RAM (SRAM), dynamic RAM (DRAM), synchronous DRAM (SDRAM), double Data Rate SDRAM (DDRSDRAM), enhanced SDRAM (ESDRAM), synchronous Link DRAM (SLDRAM), rambus (Rambus) direct RAM (RDRAM), direct Rambus Dynamic RAM (DRDRAM), and Rambus Dynamic RAM (RDRAM), among others.
The technical features of the above embodiments can be arbitrarily combined, and for the sake of brevity, all possible combinations of the technical features in the above embodiments are not described, but should be considered as the scope of the present specification as long as there is no contradiction between the combinations of the technical features.
The above-mentioned embodiments only express several embodiments of the present application, and the description thereof is more specific and detailed, but not construed as limiting the scope of the present application. It should be noted that, for a person skilled in the art, several variations and modifications can be made without departing from the concept of the present application, which falls within the scope of protection of the present application. Therefore, the protection scope of the present patent shall be subject to the appended claims.

Claims (16)

1. A method for processing service data, the method comprising:
acquiring a candidate service identifier of service data to be cached;
acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
storing the candidate service data into a data cache region, distributing an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
2. The method of claim 1, wherein storing the candidate service data in a data buffer, and allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data comprises:
combining and assembling a plurality of candidate service data corresponding to the same candidate service identifier according to a predefined data protocol structure to obtain a candidate service data object corresponding to the candidate service identifier;
and storing the candidate service data object in the data cache region, and taking the corresponding candidate service identification as an index value of the candidate service data object.
3. The method of claim 2, wherein storing the candidate business data object to the data cache comprises:
and coding the candidate service data object to obtain a coded candidate service data object, and storing the coded candidate service data object in the data cache region.
4. The method of claim 1, further comprising:
receiving a data request, wherein the data request carries a target service identifier;
determining a target index value corresponding to the target service identifier;
acquiring target service data corresponding to the target index value from the data cache region according to the index relation;
and returning the acquired target service data corresponding to the data request.
5. The method of claim 4, wherein after the receiving the data request with the target service identifier, further comprising:
when the service data corresponding to the data request is a type of service data, acquiring target service data corresponding to the target service identifier from the database according to the target service identifier;
and when the service data corresponding to the data request is the second-class service data, determining a target index value corresponding to the target service identifier.
6. The method according to claim 5, wherein the first type of service data is real-time service data, and the second type of service data is non-real-time service data;
the acquiring, by means of polling, a plurality of candidate service data corresponding to the candidate service identifier from a plurality of databases includes:
and acquiring a plurality of non-real-time service data corresponding to the candidate service identification from a plurality of databases through a polling process.
7. The method of claim 4, wherein the data request further carries a field identifier;
the obtaining of the target service data corresponding to the target index value from the data cache region according to the index relationship includes:
and acquiring field data corresponding to the field identifier from the target service data, and taking the field data as the target service data corresponding to the data request.
8. The method according to claim 1, wherein the obtaining the candidate service identifier of the service data to be cached comprises:
and acquiring the candidate service identification of the data to be cached by calling a data interface at preset time intervals.
9. The method of claim 1, further comprising:
acquiring an update service identifier of which the data changes;
and when the polling process polls again, acquiring corresponding updated service data from a plurality of databases according to the updated service identification, and updating the candidate service data in the data cache region according to the updated service data.
10. A method for processing service data, the method comprising:
receiving a data request, wherein the data request carries a target service identifier;
acquiring a target index value corresponding to the target service identifier;
acquiring target service data corresponding to the target index value from a data cache region according to the target index value, wherein candidate service data are stored in the data cache region and extracted from a plurality of databases according to candidate service identifiers through a polling process;
and returning the acquired target service data corresponding to the data request.
11. The method of claim 10, wherein the candidate service identifier is a candidate live identifier, and the candidate service data is live interaction state data;
the acquiring, from a data cache region according to the target index value, target service data corresponding to the target index value includes:
acquiring a plurality of different types of live broadcast interaction state data corresponding to the target index value from a data cache region according to the target index value;
the step of returning the obtained target service data corresponding to the data request comprises:
and returning the live broadcast interaction state data to a live broadcast watching terminal corresponding to the target live broadcast identification, so that the live broadcast interaction state data are displayed in different areas corresponding to the live broadcast watching terminal according to types.
12. The method of claim 10, wherein the candidate service identifier is a candidate information set identifier, and the candidate service data is dynamic keyword information data;
the acquiring, from a data cache region according to the target index value, target service data corresponding to the target index value includes:
acquiring a plurality of different types of dynamic keyword information data corresponding to the target index value from a data cache region according to the target index value, wherein the dynamic keyword information data are respectively extracted from a plurality of databases according to the heat of keywords;
the returning of the obtained target service data corresponding to the data request includes:
and returning the dynamic keyword information data to the terminal corresponding to the target information set identifier so as to display the dynamic keyword information data of different types in the information set in the terminal.
13. A traffic data processing apparatus, the apparatus comprising:
the identification acquisition module is used for acquiring a candidate service identification of the service data to be cached;
the polling module is used for acquiring a plurality of candidate service data corresponding to the candidate service identification from a plurality of databases in a polling mode;
and the storage module is used for storing the candidate service data into a data cache region, allocating an index value to the candidate service data according to a candidate service identifier corresponding to the candidate service data, and establishing an index relationship between the candidate service data and the index value, wherein the candidate service identifier and the index value are in one-to-one correspondence.
14. A traffic data processing apparatus, the apparatus comprising:
a request receiving module, configured to receive a data request, where the data request carries a target service identifier;
an index value obtaining module, configured to obtain a target index value corresponding to the target service identifier;
a target service data acquisition module, configured to acquire target service data corresponding to the target index value from a data cache region according to the target index value, where candidate service data are stored in the data cache region, and the candidate service data are extracted from multiple databases according to candidate service identifiers through a polling process; and the data returning module is used for returning the acquired target service data corresponding to the data request.
15. A computer-readable storage medium, storing a computer program which, when executed by a processor, causes the processor to carry out the steps of the method according to any one of claims 1 to 12.
16. A computer device comprising a memory and a processor, the memory storing a computer program that, when executed by the processor, causes the processor to perform the steps of the method of any one of claims 1 to 12.
CN201810326405.2A 2018-04-12 2018-04-12 Business data processing method and device, computer equipment and storage medium Active CN110399367B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201810326405.2A CN110399367B (en) 2018-04-12 2018-04-12 Business data processing method and device, computer equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201810326405.2A CN110399367B (en) 2018-04-12 2018-04-12 Business data processing method and device, computer equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110399367A CN110399367A (en) 2019-11-01
CN110399367B true CN110399367B (en) 2023-04-14

Family

ID=68319506

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201810326405.2A Active CN110399367B (en) 2018-04-12 2018-04-12 Business data processing method and device, computer equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110399367B (en)

Families Citing this family (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112838960B (en) * 2019-11-22 2024-03-12 中兴通讯股份有限公司 Communication data cleaning method, device, network equipment and storage medium
CN111177302B (en) * 2019-12-16 2024-02-13 金蝶软件(中国)有限公司 Service bill processing method, device, computer equipment and storage medium
CN113253880B (en) * 2020-02-11 2024-03-08 腾讯科技(深圳)有限公司 Method and device for processing pages of interaction scene and storage medium
CN111343468A (en) * 2020-02-13 2020-06-26 北京字节跳动网络技术有限公司 Message processing method and device and electronic equipment
CN112463783A (en) * 2020-12-04 2021-03-09 广州品唯软件有限公司 Index data monitoring method and device, computer equipment and storage medium
CN112966008B (en) * 2021-04-12 2023-12-05 中国人民银行数字货币研究所 Data caching method, loading method, updating method and related devices

Family Cites Families (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US8812597B2 (en) * 2007-02-21 2014-08-19 Synchronica Plc Method and system for instant messaging traffic routing
CN104750872A (en) * 2015-04-22 2015-07-01 海南易建科技股份有限公司 Method and device for searching service object
CN107222555B (en) * 2017-06-27 2020-08-25 聚好看科技股份有限公司 Message processing method and device

Also Published As

Publication number Publication date
CN110399367A (en) 2019-11-01

Similar Documents

Publication Publication Date Title
CN110399367B (en) Business data processing method and device, computer equipment and storage medium
CN110309334B (en) Query method, system, computer device and readable storage medium for graph database
CN108924250B (en) Service request processing method and device based on block chain and computer equipment
CN108491450B (en) Data caching method, device, server and storage medium
US10298970B2 (en) Image transmission method and apparatus
US20130117312A1 (en) Method and server for pushing information proactively
CN107329963B (en) Method and device for accelerating webpage access
CN108322521B (en) Message content pushing method, device, system, computer equipment and storage medium
CN109167840B (en) Task pushing method, node autonomous server and edge cache server
CN110708247B (en) Message routing method, message routing device, computer equipment and storage medium
CN106534268B (en) Data sharing method and device
US11244153B2 (en) Method and apparatus for processing information
CN109756584B (en) Domain name resolution method, domain name resolution device and computer readable storage medium
CN108154024B (en) Data retrieval method and device and electronic equipment
CN112632129A (en) Code stream data management method, device and storage medium
CN107251529B (en) Method and apparatus for transmitting and receiving information between servers in content transmission network system
CN112087335A (en) Flow experiment method, device and storage medium
CN111859127A (en) Subscription method and device of consumption data and storage medium
CN106156258B (en) Method, device and system for counting data in distributed storage system
CN107665229B (en) Information searching method, device and equipment
CN106815334A (en) A kind of data query method and device for terminal
CN115470246B (en) Request response method based on CDN, electronic equipment and storage medium
CN112967145B (en) Group information generation method and device, electronic equipment and storage medium
CN115277803A (en) Message management method, system, computer equipment and storage medium
CN112260935B (en) Message processing method and device, electronic equipment and readable 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