Hotspot data query method and device, server, storage medium and program product

By using dynamic request tables in the server to judge and cache hotspot data, the problem of database access pressure under high concurrency is solved, and the effect of reducing database burden and improving system performance is achieved.

CN119127950APending Publication Date: 2024-12-13GUIYANG SHIJIHENGTONG TECH
View PDF 3 Cites 0 Cited by

Patent Information

Application Number
CN202411284780.7
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-09-13
Publication Date
2024-12-13

AI Technical Summary

Technical Problem

In high concurrency scenarios, frequent access to the database leads to a degradation of interface performance and may even drag down the entire system. How to reduce the access burden of the database is a problem that needs to be solved.

Method used

By maintaining the dynamic request table in the server, we judge whether the data to be called is hotspot data and cache it in the cache library. If it is hotspot data, it is directly queried from the cache library or cached to the cache library, reducing direct access to the database.

Benefits of technology

It effectively reduces the access pressure of the database, improves system performance and response speed, and reduces the number of requests to the database.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119127950A_ABST
    Figure CN119127950A_ABST
Patent Text Reader

Abstract

The invention provides a hotspot data query method and device, a server, a storage medium and a program product, and relates to the field of data caching. When a data calling request of a client is received, judging whether to-be-called data belongs to hotspot data or not based on the dynamic request table; if the to-be-called data belongs to the hotspot data, querying whether the to-be-called data exists in a cache library based on the data calling request; if the to-be-called data is inquired from the cache library, directly returning the to-be-called data to the client; and if the to-be-called data is not queried from the cache library, acquiring the to-be-called data from a database, caching the to-be-called data to the cache library, and returning the to-be-called data to the client. According to the method, the hotspot data are cached through the cache library, so that the access burden of the database is effectively relieved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of data caching, and in particular to a hotspot data query method, device, server, storage medium and program product. Background Art

[0002] With the rapid development of Internet technology, the amount of data processed by databases is increasing, and the requirements for system performance are getting higher and higher. However, in high-concurrency scenarios, frequent access to the database or execution of complex calculations may cause interface performance to degrade or even bring down the entire system. Therefore, how to reduce the access burden of the database is an issue that needs to be considered. Summary of the invention

[0003] The purpose of the present invention is to provide a hotspot data query method, device, server, storage medium and program product to improve the problems existing in the prior art.

[0004] The embodiments of the present invention can be implemented as follows:

[0005] In a first aspect, the present invention provides a hotspot data query method, which is applied to a server, wherein the server maintains a dynamic request table for recording call conditions of different data; the method comprises:

[0006] When receiving a data call request from a client, determining whether the data to be called belongs to hot data based on the dynamic request table;

[0007] If the data to be called is hot data, querying from the cache whether the data to be called exists based on the data call request;

[0008] If the data to be called is found from the cache library, the data to be called is directly returned to the client;

[0009] If the data to be called is not found in the cache library, after the data to be called is obtained from the database, the data to be called is cached in the cache library and returned to the client.

[0010] Optionally, the dynamic request table includes at least one receiving timestamp corresponding to each of a plurality of different data identifiers within a preset statistical period;

[0011] The step of determining whether the data to be called belongs to hot data based on the dynamic request table when receiving a data call request from the client includes:

[0012] When receiving a data call request from the client, recording a receiving timestamp of the data call request;

[0013] If the receiving timestamp is within the preset statistical period, obtaining the query parameters of the data call request, and encrypting the current call method name and the query parameters to obtain encrypted data;

[0014] Based on the encrypted data, writing the receiving timestamp of the data call request into the dynamic request table;

[0015] Based on all receiving timestamps corresponding to the encrypted data in the dynamic request table, calculate the number of unit time calls of the requested data;

[0016] If the number of calls per unit time is greater than a preset number threshold, it is determined that the data to be called is hot data;

[0017] If the number of calls per unit time is not greater than the preset number threshold, it is determined that the data to be called does not belong to hot data.

[0018] Optionally, the step of writing the receiving timestamp of the data call request into the dynamic request table based on the encrypted data includes:

[0019] Searching the dynamic request table for a target data identifier that matches the encrypted data;

[0020] If it exists, then write the receiving timestamp of the data call request into the entry where the target data identifier is located in the dynamic request table;

[0021] If it does not exist, a new entry is added to the dynamic request table, and the target data identifier and the receiving timestamp of the data call request are written into the new entry.

[0022] Optionally, the step of querying from the cache whether the to-be-called data exists based on the data call request includes:

[0023] Obtaining encrypted data; the encrypted data is obtained by encrypting the current calling method name and the query parameters of the data calling request;

[0024] Using the encrypted data as a query key, querying whether there is a key-value pair matching the query key in the cache library;

[0025] If it exists, then obtain the value in the key-value pair to obtain the data to be called;

[0026] If not, it is determined that the to-be-called data does not exist in the cache library.

[0027] Optionally, the step of caching the to-be-called data in the cache library includes:

[0028] Obtaining encrypted data; the encrypted data is obtained by encrypting the current calling method name and the query parameters of the data calling request;

[0029] The encrypted data and the data to be called are stored in the cache library in the form of key-value pairs.

[0030] In a second aspect, the present invention provides a hotspot data query device, which is applied to a server, wherein the server maintains a dynamic request table for recording the call status of different data; the device comprises:

[0031] A request receiving module, configured to determine whether the data to be called belongs to hot data based on the dynamic request table when receiving a data call request from a client;

[0032] Query module for:

[0033] If the data to be called is hot data, querying from the cache whether the data to be called exists based on the data call request;

[0034] If the data to be called is found from the cache library, the data to be called is directly returned to the client;

[0035] If the data to be called is not found in the cache library, after the data to be called is obtained from the database, the data to be called is cached in the cache library and returned to the client.

[0036] In an optional implementation manner, the dynamic request table includes at least one receiving timestamp corresponding to each of a plurality of different data identifiers within a preset statistical period; the request receiving module is specifically configured to:

[0037] When receiving a data call request from the client, recording a receiving timestamp of the data call request;

[0038] If the receiving timestamp is within the preset statistical period, obtaining the query parameters of the data call request, and encrypting the current call method name and the query parameters to obtain encrypted data;

[0039] Based on the encrypted data, writing the receiving timestamp of the data call request into the dynamic request table;

[0040] Based on all receiving timestamps corresponding to the encrypted data in the dynamic request table, calculate the number of unit time calls of the requested data;

[0041] If the number of calls per unit time is greater than a preset number threshold, it is determined that the data to be called is hot data;

[0042] If the number of calls per unit time is not greater than the preset number threshold, it is determined that the data to be called does not belong to hot data.

[0043] In a third aspect, the present invention provides a server, comprising: a memory and a processor, wherein the memory stores a software program, and when the server is running, the processor executes the software program to implement the hotspot data query method as described in the first aspect above.

[0044] In a fourth aspect, the present invention provides a computer-readable storage medium, wherein the computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the hotspot data query method described in the first aspect is implemented.

[0045] In a fifth aspect, the present invention provides a program product, which, when executed by a processor, implements the hotspot data query method described in the first aspect.

[0046] Compared with the prior art, the embodiment of the present invention provides a hot data query method, device, server, storage medium and program product. When receiving a data call request from a client, it is determined whether the data to be called belongs to hot data based on the dynamic request table; if the data to be called belongs to hot data, it is queried from the cache library whether the data to be called exists based on the data call request; if the data to be called is found from the cache library, the data to be called is directly returned to the client; if the data to be called is not found from the cache library, the data to be called is obtained from the database, and then the data to be called is cached in the cache library and returned to the client. In the present invention, hot data is cached through the cache library, which effectively reduces the access burden of the database. BRIEF DESCRIPTION OF THE DRAWINGS

[0047] In order to more clearly illustrate the technical solutions of the embodiments of the present invention, the drawings required for use in the embodiments are briefly introduced below. It should be understood that the following drawings only show certain embodiments of the present invention and therefore should not be regarded as limiting the scope. For ordinary technicians in this field, other related drawings can be obtained based on these drawings without creative work.

[0048] Figure 1 One of the flow charts of a hotspot data query method provided in an embodiment of the present invention.

[0049] Figure 2 The second flowchart of a hotspot data query method provided by an embodiment of the present invention.

[0050] Figure 3 A schematic diagram of the structure of a hotspot data query device provided in an embodiment of the present invention.

[0051] Figure 4 A schematic diagram of the structure of a server provided in an embodiment of the present invention. DETAILED DESCRIPTION

[0052] In order to make the purpose, technical solutions and advantages of the embodiments of the present invention clearer, the technical solutions in the embodiments of the present invention will be clearly and completely described below in conjunction with the drawings in the embodiments of the present invention. Obviously, the described embodiments are part of the embodiments of the present invention, not all of the embodiments. Generally, the components of the embodiments of the present invention described and shown in the drawings here can be arranged and designed in various different configurations.

[0053] Therefore, the following detailed description of the embodiments of the present invention provided in the accompanying drawings is not intended to limit the scope of the invention claimed for protection, but merely represents selected embodiments of the present invention. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without creative work are within the scope of protection of the present invention.

[0054] It should be noted that similar reference numerals and letters denote similar items in the following drawings, and therefore, once an item is defined in one drawing, further definition and explanation thereof is not required in subsequent drawings.

[0055] It should be noted that, in the absence of conflict, the features in the embodiments of the present invention may be combined with each other.

[0056] Please refer to Figure 1 , Figure 1 A flowchart of a hot data query method provided by an embodiment of the present invention is provided. The method is applied to a server, and the server maintains a dynamic request table for recording the call status of different data. The method comprises the following steps:

[0057] S101. When receiving a data call request from a client, determine whether the data to be called is hot data based on a dynamic request table.

[0058] In this embodiment, hot data refers to data that is frequently accessed or used, such as the product query service in an e-commerce project, which supports querying product information by entering a product ID. When a product A is discounted, the query access frequency of its product information is very high, which is hot data. This example is only an example and is not limited here.

[0059] S102: If the data to be called is hot data, query whether the data to be called exists from the cache based on the data call request.

[0060] In this embodiment, the cache library is used to cache hot data, so if the data to be called is hot data, it is possible to directly query whether the data to be called exists from the cache library based on the data call request.

[0061] Optionally, the cache library can use Redis cache.

[0062] S103: If the data to be called is found from the cache, the data to be called is directly returned to the client.

[0063] In this embodiment, if the data to be called is queried from the cache library, the data to be called can be directly returned to the client.

[0064] S104: If the data to be called is not found in the cache library, the data to be called is obtained from the database, cached in the cache library and returned to the client.

[0065] In this embodiment, if the data to be called is not found from the cache library, it means that this is the first time that it is determined to be hot data. The data to be called needs to be found from the database first, and then returned to the client and stored in the cache library for the next call.

[0066] The hot data query method provided by the embodiment of the present invention determines whether the data to be called belongs to hot data based on the dynamic request table when receiving a data call request from the client; if the data to be called belongs to hot data, it queries whether the data to be called exists from the cache based on the data call request; if the data to be called is found from the cache, it directly returns the data to be called to the client; if the data to be called is not found from the cache, it obtains the data to be called from the database, caches the data to be called in the cache and returns it to the client. In the present invention, the hot data is cached through the cache, which effectively reduces the access burden of the database.

[0067] In an optional implementation, the dynamic request table includes the call counts corresponding to multiple different data identifiers within a preset statistical period. Figure 1 Based on Figure 2 In the above step S101, when a data call request from the client is received, the process of determining whether the data to be called belongs to hot data based on the dynamic request table may include the following sub-steps S1011 to S1016.

[0068] S1011. When receiving a data call request from a client, record a receiving timestamp of the data call request.

[0069] In this embodiment, a Sentinel component may be deployed in the server. The Sentinel component identifies specific parameters in the data call request (such as user ID, product ID, etc.). These parameters are usually closely related to the business logic and are potential "hot spots".

[0070] S1012: If the receiving timestamp is in a preset statistical period, the query parameters of the data call request are obtained, and the current call method name and the query parameters are encrypted to obtain encrypted data.

[0071] In this embodiment, after the Sentinel component identifies a data call request including specific parameters, it records the receiving timestamp of the data call request. If the receiving timestamp is within the preset statistical period, the data call request will be intercepted, and then further determined whether the data to be called is hot data.

[0072] Optionally, the preset statistical period may be a pre-set fixed period related to the business, such as a daily flash sale period for commodities (eg, 10:00-11:00 or 20:00-21:00). This example is only an example and is not limited here.

[0073] Optionally, the MD5 encryption algorithm may be used to encrypt the current calling method name and query parameters. For example, during a certain e-commerce shopping festival, product A is on sale. When the system queries product A, method a is called. The query parameter used is the product ID of product A. The name of method a and the product ID are encrypted with MD5 to obtain the encrypted data. This example is only an example and is not limited here.

[0074] S1013. Based on the encrypted data, write the receiving timestamp of the data call request into the dynamic request table.

[0075] In this embodiment, the encrypted data can be used as the data identifier, and then the receiving timestamp of the data call request is written into the dynamic request table. Correspondingly, the sub-steps of step S1013 may include (1) to (3):

[0076] (1) Searching the dynamic request table for a target data identifier that matches the encrypted data;

[0077] (2) If it exists, write the receiving timestamp of the data call request into the entry where the target data identifier is located in the dynamic request table;

[0078] (3) If it does not exist, a new entry is added to the dynamic request table, and the target data identifier and the receiving timestamp of the data call request are written into the new entry.

[0079] S1014. Calculate the number of calls per unit time of the data to be requested based on all receiving timestamps corresponding to the encrypted data in the dynamic request table.

[0080] S1015: If the number of calls per unit time is greater than a preset number threshold, it is determined that the data to be called is hot data.

[0081] S1016: If the number of calls per unit time is not greater than the preset number threshold, it is determined that the data to be called does not belong to hot data.

[0082] Optionally, the preset number threshold may be set to 10 or 20.

[0083] Sentinel components support custom hot data cache annotations. Annotation parameters can include: preset statistical period, preset number threshold, and data cache expiration time (i.e., data expiration time in the cache library). Optionally, based on Java's dynamic proxy and AOP (aspect-oriented programming) ideas, you can implement the InstantiationAwareBeanPostProcessor interface and rewrite the postProcessAfterInitialization method, which is triggered after the Bean is instantiated and attribute injection is completed in Spring. When registering the Bean in the Spring container, check whether there is a method annotated with a custom hot data cache annotation. If so, add a Proxy proxy object to the method, use ByteBuddy to implement method delegation, implement the InvocationHandler interface, and rewrite its invoke method. You can intercept method calls to the target object (i.e., including specific parameters), and register a Sentinel ParamFlowRule parameter flow limiting rule for this method based on the custom hot data cache annotation parameters to determine whether it belongs to hot data.

[0084] In an optional implementation, after determining that the data to be called does not belong to hot data, it is possible to search the cache library based on the encrypted data to see whether there is a key-value pair corresponding to the encrypted data. If so, the key-value pair can be deleted from the cache library. In this way, non-hot data in the cache library can be cleared in time, so that the cache library can reserve storage space for real hot data, allowing the system to flexibly respond to traffic changes and business needs.

[0085] In an optional implementation, searching the cache for the data to be called is also based on the encrypted data obtained above. Correspondingly, the sub-steps of the above step S102 may include S1021 to S1024.

[0086] S1021. Obtain encrypted data.

[0087] In this embodiment, the encrypted data is obtained by encrypting the query parameters of the current calling method name and the data calling request in the above step S1012.

[0088] S1022: Use the encrypted data as a query key to query whether there is a key-value pair matching the query key in the cache library.

[0089] S1023. If it exists, obtain the value in the key-value pair to obtain the data to be called.

[0090] S1024: If not, determine that the data to be called does not exist in the cache library.

[0091] In this embodiment, data is cached in the cache library in the form of key-value pairs, so encrypted data can be used as a query key to query whether there is a key-value pair matching the query key in the cache library. If so, the value in the key-value pair is obtained to obtain the data to be called. If not, it means that the data to be called is new hot data and is also cached in the cache library.

[0092] In an optional implementation, the process of caching the to-be-called data into the cache library in the above step S104 may include:

[0093] (1) Obtaining encrypted data; the encrypted data is obtained by encrypting the query parameters of the current calling method name and the data calling request;

[0094] (2) The encrypted data and the data to be called are stored in the cache in the form of key-value pairs.

[0095] It should be noted that the execution order of each step in the above method embodiment is not limited to that shown in the drawings, and the execution order of each step shall be based on the actual application situation.

[0096] Compared with the prior art, the embodiments of the present invention have the following beneficial effects:

[0097] (1) Reduce database pressure. Since the cache can store and quickly provide hot data, the number of data requests received by the database will be reduced accordingly, thereby reducing the pressure on the database.

[0098] (2) Improve system performance. By storing hot data in the cache, the system can significantly reduce the number of times data is read from the database or other slow storage, thereby improving the system's response speed and throughput.

[0099] In order to execute the corresponding steps in the above method embodiment and each possible implementation mode, an implementation method of a hotspot data query device is given below.

[0100] See also Figure 3 , Figure 3The hot data query device 200 is applied to a server, and the server maintains a dynamic request table for recording the call status of different data. The hot data query device 200 includes: a request receiving module 210 and a query module 220.

[0101] The request receiving module 210 is used to determine whether the data to be called belongs to hot data based on the dynamic request table when receiving a data call request from the client;

[0102] The query module 220 is used to: if the data to be called is hot data, query whether the data to be called exists in the cache library based on the data call request; if the data to be called is found from the cache library, directly return the data to be called to the client; if the data to be called is not found from the cache library, after obtaining the data to be called from the database, cache the data to be called in the cache library and return it to the client.

[0103] Optionally, the dynamic request table includes at least one receiving timestamp corresponding to each of a plurality of different data identifiers within a preset statistical period. The request receiving module 210 can be specifically used to: when receiving a data call request from the client, record the receiving timestamp of the data call request; if the receiving timestamp is within the preset statistical period, obtain the query parameters of the data call request, encrypt the current calling method name and the query parameters to obtain encrypted data; based on the encrypted data, write the receiving timestamp of the data call request into the dynamic request table; based on all receiving timestamps corresponding to the encrypted data in the dynamic request table, calculate the number of unit time calls for the data to be requested; if the number of unit time calls is greater than the preset number threshold, determine that the data to be called belongs to hot data; if the number of unit time calls is not greater than the preset number threshold, determine that the data to be called does not belong to hot data.

[0104] Optionally, when the request receiving module 210 is used to write the receiving timestamp of the data call request into the dynamic request table based on the encrypted data, it can be specifically used to: search the dynamic request table for a target data identifier that matches the encrypted data; if so, write the receiving timestamp of the data call request into the table entry in the dynamic request table where the target data identifier is located; if not, add a new entry to the dynamic request table, and write the target data identifier and the receiving timestamp of the data call request into the newly added entry.

[0105] Optionally, when the query module 220 is used to query whether the data to be called exists in the cache library based on the data call request, it can be specifically used to: obtain encrypted data; the encrypted data is obtained by encrypting the current calling method name and the query parameters of the data call request; using the encrypted data as the query key, querying whether there is a key-value pair matching the query key in the cache library; if so, obtaining the value in the key-value pair to obtain the data to be called; if not, determining that the data to be called does not exist in the cache library.

[0106] Optionally, when the query module 220 is used to cache the data to be called into the cache library, it can be specifically used to: obtain encrypted data; the encrypted data is obtained by encrypting the current calling method name and the query parameters of the data calling request; the encrypted data and the data to be called are stored in the cache library in the form of key-value pairs.

[0107] Those skilled in the art can clearly understand that, for the convenience and brevity of description, the specific working process of the hotspot data query device 200 described above can refer to the corresponding process in the aforementioned method embodiment, and will not be repeated here.

[0108] See also Figure 4 , Figure 4 The server 300 includes a processor 310 , a memory 320 , and a bus 330 , wherein the processor 310 is connected to the memory 320 via the bus 330 .

[0109] The memory 320 may be used to store software programs, for example, software programs corresponding to the hotspot data query device 200 provided in the embodiment of the present invention. The processor 310 executes various functional applications and data processing to implement the hotspot data query method provided in the embodiment of the present invention by running the software programs stored in the memory 320.

[0110] Among them, the memory 320 can be but is not limited to: RAM (Random Access Memory), ROM (Read Only Memory), FLASH (Flash Memory), PROM (Programmable Read-Only Memory), EPROM (Erasable Programmable Read-Only Memory), EEPROM (Electric Erasable Programmable Read-Only Memory), etc.

[0111] The processor 310 may be an integrated circuit chip with signal processing capability. The processor 310 may be a general-purpose processor, including: CPU (Central Processing Unit), NP (Network Processor), etc.; it may also be: DSP (Digital Signal Processing), ASIC (Application Specific Integrated Circuit), FPGA (Field-Programmable Gate Array) or other programmable logic devices, discrete gate or transistor logic devices, discrete hardware components.

[0112] Understandably, Figure 4 The structure shown is for illustration only. The server 300 may also include Figure 4 More or fewer components as shown, or with Figure 4 Different configurations are shown. Figure 4 Each component shown in the figure can be implemented by hardware, software or a combination thereof.

[0113] The embodiment of the present invention also provides a computer-readable storage medium, on which a computer program is stored, and when the computer program is executed by a processor, the hotspot data query method disclosed in the above embodiment is implemented. The computer-readable storage medium can be, but is not limited to, various media that can store program codes, such as a USB flash drive, a mobile hard disk, a ROM, a RAM, a PROM, an EPROM, an EEPROM, a FLASH disk, or an optical disk.

[0114] An embodiment of the present invention further provides a program product, which implements the hotspot data query method disclosed in the above embodiment when executed by a processor.

[0115] In summary, the embodiments of the present invention provide a hot data query method, device, server, storage medium and program product. When a data call request from a client is received, it is determined whether the data to be called belongs to hot data based on the dynamic request table; if the data to be called belongs to hot data, it is queried from the cache library whether the data to be called exists based on the data call request; if the data to be called is found from the cache library, the data to be called is directly returned to the client; if the data to be called is not found from the cache library, the data to be called is obtained from the database, and then the data to be called is cached in the cache library and returned to the client. In the present invention, hot data is cached through the cache library, which effectively reduces the access burden of the database.

[0116] The above are only specific embodiments of the present invention, but the protection scope of the present invention is not limited thereto. Any changes or substitutions that can be easily thought of by a person skilled in the art within the technical scope disclosed by the present invention should be included in the protection scope of the present invention. Therefore, the protection scope of the present invention shall be subject to the protection scope of the claims.

Claims

1. A hotspot data query method, characterized in that: Applied to a server, the server maintains a dynamic request table for recording the calling conditions of different data; the method comprises: When receiving a data call request from a client, determining whether the data to be called belongs to hot data based on the dynamic request table; If the data to be called is hot data, querying from the cache whether the data to be called exists based on the data call request; If the data to be called is found from the cache library, the data to be called is directly returned to the client; If the data to be called is not found in the cache library, after the data to be called is obtained from the database, the data to be called is cached in the cache library and returned to the client.

2. The method according to claim 1, characterized in that The dynamic request table includes at least one receiving timestamp corresponding to each of a plurality of different data identifiers within a preset statistical period; The step of determining whether the data to be called belongs to hot data based on the dynamic request table when receiving a data call request from the client includes: When receiving a data call request from the client, recording a receiving timestamp of the data call request; If the receiving timestamp is within the preset statistical period, obtaining the query parameters of the data call request, and encrypting the current call method name and the query parameters to obtain encrypted data; Based on the encrypted data, writing the receiving timestamp of the data call request into the dynamic request table; Based on all receiving timestamps corresponding to the encrypted data in the dynamic request table, calculate the number of unit time calls of the requested data; If the number of calls per unit time is greater than a preset number threshold, it is determined that the data to be called is hot data; If the number of calls per unit time is not greater than the preset number threshold, it is determined that the data to be called does not belong to hot data.

3. The method according to claim 2, characterized in that The step of writing the receiving timestamp of the data call request into the dynamic request table based on the encrypted data comprises: Searching the dynamic request table for a target data identifier that matches the encrypted data; If it exists, then write the receiving timestamp of the data call request into the entry where the target data identifier is located in the dynamic request table; If it does not exist, a new entry is added to the dynamic request table, and the target data identifier and the receiving timestamp of the data call request are written into the new entry.

4. The method according to claim 1, characterized in that: The step of querying from the cache whether the to-be-called data exists based on the data call request comprises: Obtaining encrypted data; the encrypted data is obtained by encrypting the current calling method name and the query parameters of the data calling request; Using the encrypted data as a query key, querying whether there is a key-value pair matching the query key in the cache library; If it exists, then obtain the value in the key-value pair to obtain the data to be called; If not, it is determined that the to-be-called data does not exist in the cache library.

5. The method according to claim 1, characterized in that The step of caching the to-be-called data into the cache library comprises: Obtaining encrypted data; the encrypted data is obtained by encrypting the current calling method name and the query parameters of the data calling request; The encrypted data and the data to be called are stored in the cache library in the form of key-value pairs.

6. A hotspot data query device, characterized in that: Applied to a server, the server maintains a dynamic request table for recording the calling conditions of different data; the device comprises: A request receiving module, configured to determine whether the data to be called belongs to hot data based on the dynamic request table when receiving a data call request from a client; Query module for: If the data to be called is hot data, querying from the cache whether the data to be called exists based on the data call request; If the data to be called is found from the cache library, the data to be called is directly returned to the client; If the data to be called is not found in the cache library, after the data to be called is obtained from the database, the data to be called is cached in the cache library and returned to the client.

7. The device according to claim 6, characterized in that The dynamic request table includes at least one receiving timestamp corresponding to each of a plurality of different data identifiers within a preset statistical period; the request receiving module is specifically used to: When receiving a data call request from the client, recording a receiving timestamp of the data call request; If the receiving timestamp is within the preset statistical period, obtaining the query parameters of the data call request, and encrypting the current call method name and the query parameters to obtain encrypted data; Based on the encrypted data, writing the receiving timestamp of the data call request into the dynamic request table; Based on all receiving timestamps corresponding to the encrypted data in the dynamic request table, calculate the number of unit time calls of the requested data; If the number of calls per unit time is greater than a preset number threshold, it is determined that the data to be called is hot data; If the number of calls per unit time is not greater than the preset number threshold, it is determined that the data to be called does not belong to hot data.

8. A server, characterized in that: include: A memory and a processor, wherein the memory stores a software program, and when the server is running, the processor executes the software program to implement the hotspot data query method as described in any one of claims 1-5.

9. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores a computer program, and when the computer program is executed by a processor, the hotspot data query method according to any one of claims 1 to 5 is implemented.

10. A program product, characterized in that When the program product is executed by a processor, the hotspot data query method described in any one of claims 1 to 5 is implemented.

Citation Information

Patent Citations

  • Method for querying hot data

    CN104268286A

  • Query request response method and device, storage medium and electronic device

    CN114254001A

  • Data caching method and device, electronic equipment and storage medium

    CN115687422A