Cache data processing method and device, equipment and storage medium

By carrying acceptable data validity periods in data requests and dynamically adjusting the validity periods of cached data, the problem of low cache usage efficiency in the prior art is solved, and efficient cache management is achieved in different business scenarios.

CN119484639APending Publication Date: 2025-02-18BANK OF CHINA
View PDF 7 Cites 0 Cited by

Patent Information

Application Number
CN202411561347.3
Authority / Receiving Office
CN · China
Patent Type
Applications(China)
Current Assignee / Owner
Filing Date
2024-11-04
Publication Date
2025-02-18

AI Technical Summary

Technical Problem

When setting the validity period of cache data in the prior art, there is a problem of low cache usage efficiency, especially in different business scenarios, where the validity period is different.

Method used

By carrying an acceptable data validity period in the data request sent by the data requester, it is determined whether there is the target cache data corresponding to the data request within the acceptable data validity period in the cache. If it exists, it will be obtained from the cache. If it does not exist, it will be obtained from the cache. Update cached data.

Benefits of technology

It realizes dynamic adjustment of cached data validity period according to different business scenarios, improves cache usage efficiency, and reduces the frequency of access to source data.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119484639A_ABST
    Figure CN119484639A_ABST
Patent Text Reader

Abstract

The invention provides a cache data processing method and device, equipment and a storage medium. The method can be used in big data field. The cache data processing method comprises the following steps: receiving a data request sent by a data requester, wherein the data request carries an acceptable data validity period; determining whether target cache data within an acceptable data validity period corresponding to the data request exists in a cache or not; if yes, obtaining target cache data from the cache, and sending the target cache data to the data requester; and if not, updating the cached data in the cache, and sending the updated cached data corresponding to the data request to the data requester. The problem of different validity periods of the cache in different service scenes can be solved, the access frequency of the source data is effectively reduced, and the cache use efficiency is improved.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of big data, and in particular to a cache data processing method, device, equipment and storage medium. Background Art

[0002] Data caching is a technology used to improve data access speed and efficiency. Data caching can improve system performance by temporarily storing frequently accessed data in a fast-access storage area (i.e., cache) to reduce the frequency of fetching data from slower main memory or remote data sources.

[0003] At present, when storing data in a cache, a unified validity period is usually set for the cached data. If the validity period expires, the cached data cannot be obtained from the cache. However, in some scenarios, setting the validity period of cached data in the above manner may result in low cache usage efficiency. Summary of the invention

[0004] The embodiments of the present application provide a cache data processing method, device, equipment and storage medium to achieve the effect of improving cache usage efficiency.

[0005] In a first aspect, the present application provides a cache data processing method, comprising:

[0006] Receiving a data request sent by a data requester, the data request carrying an acceptable data validity period;

[0007] Determine whether there is target cache data corresponding to the data request within an acceptable data validity period in the cache;

[0008] If so, the target cache data is obtained from the cache and sent to the data requester; if not, the cache data in the cache is updated and the updated cache data corresponding to the data request is sent to the data requester.

[0009] In one possible implementation, determining whether there is target cache data within an acceptable data validity period corresponding to a data request in the cache includes: obtaining the storage duration of the cache data based on the current time and the storage time corresponding to the cache data in the cache; if the storage duration is less than or equal to the acceptable data validity period, determining that there is target cache data within an acceptable data validity period corresponding to the data request in the cache; if the storage duration is greater than the acceptable data validity period, determining that there is no target cache data within an acceptable data validity period corresponding to the data request in the cache.

[0010] In a possible implementation, updating cached data in the cache includes: obtaining all source data from a source data holder corresponding to the cache, updating all source data to the cache, and recording storage time of all source data in the cache.

[0011] In one possible implementation, updating cached data in a cache includes: obtaining target source data whose storage duration is greater than an acceptable data validity period from a source data holder corresponding to the cache, updating the target source data to the cache, and recording the storage time of the target source data in the cache.

[0012] In a possible implementation manner, the acceptable data validity period is set by the data requester according to different business scenarios, and the acceptable data validity periods carried by different data requests may be the same or different.

[0013] In a possible implementation, before receiving the data request sent by the data requester, the cache data processing method further includes: maintaining the cache data in the cache.

[0014] In a second aspect, the present application provides a cache data processing device, including:

[0015] A receiving module, used for receiving a data request sent by a data requester, wherein the data request carries an acceptable data validity period;

[0016] A determination module, used to determine whether there is target cache data corresponding to the data request within an acceptable data validity period in the cache;

[0017] The processing module is used to obtain the target cache data from the cache if yes and send the target cache data to the data requester; if no, update the cache data in the cache and send the updated cache data corresponding to the data request to the data requester.

[0018] In one possible implementation, the determination module is specifically used to: obtain the storage duration of the cached data based on the current time and the storage time corresponding to the cached data in the cache; if the storage duration is less than or equal to the acceptable data validity period, determine that there is target cached data within the acceptable data validity period corresponding to the data request in the cache; if the storage duration is greater than the acceptable data validity period, determine that there is no target cached data within the acceptable data validity period corresponding to the data request in the cache.

[0019] In a possible implementation, when the processing module is used to update cached data in the cache, it is specifically used to: obtain all source data from the source data holder corresponding to the cache, update all source data to the cache, and record the storage time of all source data in the cache.

[0020] In one possible implementation, when the processing module is used to update cached data in the cache, it is specifically used to: obtain target source data whose storage time is greater than an acceptable data validity period from the source data holder corresponding to the cache, update the target source data to the cache, and record the storage time of the target source data in the cache.

[0021] In a possible implementation manner, the acceptable data validity period is set by the data requester according to different business scenarios, and the acceptable data validity periods carried by different data requests may be the same or different.

[0022] In a possible implementation manner, the processing module is further configured to: before receiving a data request sent by a data requester, maintain cached data in the cache.

[0023] In a third aspect, the present application provides an electronic device, comprising: a processor, and a memory communicatively connected to the processor;

[0024] Memory stores computer-executable instructions;

[0025] The processor executes the computer-executable instructions stored in the memory to implement the above first aspect and / or various possible implementations of the first aspect.

[0026] In a fourth aspect, the present application provides a computer-readable storage medium, in which computer program instructions are stored. When the computer program instructions are executed, the above first aspect and / or various possible implementation methods of the first aspect are implemented.

[0027] In a fifth aspect, the present application provides a computer program product, including a computer program, which implements the above first aspect and / or various possible implementation methods of the first aspect when the computer program is executed.

[0028] The cache data processing method, apparatus, device and storage medium provided in the present application carry an acceptable data validity period in the data request sent by the data requester, and use the acceptable data validity period to participate in the processing of whether the cache data in the cache is valid, that is, the validity period of the cache data in the cache is determined according to the acceptable data validity period carried by the data request, so that the data requester determines the validity period of the cache data in the cache. If it is determined that the target cache data corresponding to the data request within the acceptable data validity period exists in the cache, the target cache data is obtained from the cache and the target cache data is sent to the data requester; if it is determined that the target cache data corresponding to the data request within the acceptable data validity period does not exist in the cache, the cache data in the cache is updated, and the updated cache data corresponding to the data request is sent to the data requester. This can solve the problem of different cache validity periods in different business scenarios, effectively reduce the frequency of access to source data, and improve cache usage efficiency. BRIEF DESCRIPTION OF THE DRAWINGS

[0029] The accompanying drawings, which are incorporated in and constitute a part of this specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the present application.

[0030] Figure 1 A schematic diagram of an application scenario provided for an embodiment of the present application;

[0031] Figure 2 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 1 ;

[0032] Figure 3 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 2 ;

[0033] Figure 4 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 3 ;

[0034] Figure 5 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 4 ;

[0035] Figure 6 A schematic diagram of the structure of a cache data processing device provided in one embodiment of the present application;

[0036] Figure 7 A schematic diagram of the structure of an electronic device provided in one embodiment of the present application.

[0037] The above drawings have shown clear embodiments of the present application, which will be described in more detail later. These drawings and text descriptions are not intended to limit the scope of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0038] Exemplary embodiments will be described in detail herein, examples of which are shown in the accompanying drawings. When the following description refers to the drawings, the same numbers in different drawings represent the same or similar elements unless otherwise indicated. The implementations described in the following exemplary embodiments do not represent all implementations consistent with the present application. Instead, they are merely examples of devices and methods consistent with some aspects of the present application as detailed in the appended claims.

[0039] It should be noted that the user information (including but not limited to user device information, user personal information, etc.) and data (including but not limited to data used for analysis, stored data, displayed data, etc.) involved in this application are all information and data authorized by the user or fully authorized by all parties, and the collection, use and processing of relevant data must comply with relevant laws, regulations and standards, and provide corresponding operation entrances for users to choose to authorize or refuse.

[0040] Data caching is a technology used to improve data access speed and efficiency, and is also a commonly used performance improvement method. Data caching can improve system performance by temporarily storing frequently accessed data in a fast-access storage area (i.e., cache) to reduce the frequency of obtaining data from slower main memory or remote data sources. Specifically, a cache data holder is added between the data requester (data user) and the source data holder. When the data requester needs to use data, it requests the data from the cache data holder: if the data exists in the cache, the data is obtained from the cache and sent to the data requester; if the data does not exist in the cache, the cache data holder requests the source data from the source data holder, updates the obtained source data to the cache, and sends the updated cache data to the data requester.

[0041] At present, when storing data in a cache, the cache data holder usually sets a unified validity period for the cache data. If the validity period expires, the cache data cannot be obtained from the cache. However, in some scenarios, setting the validity period of cache data in the above manner results in low cache utilization efficiency. Specifically, although the above cache data processing method can flexibly set the validity period of cache data, such as setting the validity period of cache data to 1 hour, or 2 hours, etc., the validity period is set by the cache data holder. In different usage scenarios, when different data requesters request data, they all use the same validity period, which cannot be flexibly changed. This is out of touch with the actual usage scenario and results in low cache utilization efficiency.

[0042] Based on the above problems, the present application provides a cache data processing method, apparatus, device and storage medium, in which the data requester determines the acceptable data validity period according to the specific business scenario, and carries the acceptable data validity period in the data request sent by the data requester. The acceptable data validity period is used to process whether the cached data in the cache is valid, that is, the validity period of the cached data in the cache is determined according to the acceptable data validity period carried by the data request, so that the data requester can decide the validity period of the cached data in the cache, which can solve the problem of different cache validity periods in different business scenarios, effectively reduce the frequency of access to source data, and improve cache usage efficiency.

[0043] It should be noted that the cache data processing method, device, equipment and storage medium of the present application can be used in the field of big data, and can also be used in any field other than the field of big data. The application field of the cache data processing method, device, equipment and storage medium of the present application is not limited.

[0044] In the following, the application scenarios of the solutions provided in this application are first illustrated.

[0045] Figure 1 This is a schematic diagram of an application scenario provided by an embodiment of the present application. Figure 1 As shown, the application scenario includes: a data requester, a cache data holder and a source data holder. The data requester and the cache data holder can communicate through a wired network or a wireless network; the cache data holder and the source data holder can communicate through a wired network or a wireless network. The data requester sends a data request to the cache data holder according to the business scenario, and the data request carries an acceptable data validity period. Based on the acceptable data validity period carried by the data request, the cache data holder sends the cache data corresponding to the data request to the data requester through the cache data processing method provided in the present application. Among them, the source data holder stores the source data corresponding to the cache data holder, and the source data is used to update the cache data in the cache.

[0046] It should be noted that Figure 1 This is only a schematic diagram of an application scenario provided by the embodiment of the present application. Figure 1 does not limit the equipment included in Figure 1 The positional relationship between the devices is limited.

[0047] The technical solution of the present application and how the technical solution of the present application solves the above-mentioned technical problems are described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be repeated in some embodiments. The embodiments of the present application will be described below in conjunction with the accompanying drawings.

[0048] Figure 2 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 1 The method of the embodiment of the present application can be applied to an electronic device, which can be a server or a server cluster. Figure 2 As shown, the method of the embodiment of the present application includes:

[0049] S201. Receive a data request sent by a data requester, where the data request carries an acceptable data validity period.

[0050] In the embodiments of the present application, it can be understood that the data requester can also be referred to as the data user, and can obtain cached data from the cache according to different business scenarios to improve data access efficiency, thereby applying the obtained cached data to different business scenarios. Among them, the data requester may have different requirements for the timeliness of data according to different business scenarios. For example, some data requesters may need data from the past hour, and some data requesters may need data from the past 2 hours, etc. Therefore, when the data requester sends a data request to the electronic device executing the embodiment of the present method, the data request carries an acceptable data validity period to obtain the cached data within the acceptable data validity period corresponding to the data request.

[0051] Optionally, the acceptable data validity period is set by the data requester according to different business scenarios, and the acceptable data validity periods carried by different data requests may be the same or different.

[0052] Exemplarily, the data requester can set an acceptable data validity period according to different business scenarios. For example, the data user can set the acceptable data validity period to 1 hour, that is, the data within the past 1 hour meets the business scenario; the data user can set the acceptable data validity period to 2 hours, that is, the data within the past 2 hours meets the business scenario. The data user can conveniently and flexibly set the acceptable data validity period according to different business scenarios. Accordingly, the acceptable data validity periods carried by different data requests may be the same, or may be different.

[0053] In this step, exemplarily, a data request sent by a data requester is received and parsed, and an acceptable data validity period carried by the data request can be obtained. The data request can also carry other request information corresponding to the business scenario. The embodiment of the present application does not limit other request information.

[0054] Optionally, before receiving a data request sent by a data requester, the cache data processing method provided in the embodiment of the present application may further include: maintaining the cache data in the cache.

[0055] It can be understood that the embodiment of the present application stores a cached data in the cache, and before receiving the data request sent by the data requester, the cached data in the cache is maintained, that is, the cached data in the cache is not updated. The data request sent by the data requester triggers the update of the cached data in the cache. For specific information on how to update the cached data in the cache, please refer to the subsequent embodiments, which will not be repeated here.

[0056] S202: Determine whether there is target cache data corresponding to the data request within an acceptable data validity period in the cache.

[0057] In this step, it can be determined whether there is target cache data in the cache that corresponds to the data request and is within the acceptable data validity period, based on the acceptable data validity period carried by the data request. Exemplarily, the storage duration of the cache data in the cache can be obtained, and the storage duration can be compared with the acceptable data validity period to determine whether there is target cache data in the cache that corresponds to the data request and is within the acceptable data validity period. For specific information on how to determine whether there is target cache data in the cache that corresponds to the data request and is within the acceptable data validity period, please refer to the subsequent embodiments, which will not be repeated here.

[0058] S203: If yes, obtain the target cache data from the cache and send the target cache data to the data requester; if no, update the cache data in the cache and send the updated cache data corresponding to the data request to the data requester.

[0059] Exemplarily, if it is determined that the target cache data corresponding to the data request exists in the cache within an acceptable data validity period, the target cache data can be directly obtained from the cache and sent to the data requester. If it is determined that the target cache data corresponding to the data request does not exist in the cache within an acceptable data validity period, the cache data in the cache can be updated, and the updated cache data corresponding to the data request can be sent to the data requester. When updating the cache data in the cache, all cache data can be updated, or part of the cache data corresponding to the data request can be updated. For example, taking the update of all cache data as an example, all source data can be obtained from the source data holder corresponding to the cache, all source data can be updated to the cache, and the storage time of all source data in the cache can be recorded, thereby obtaining all updated cache data, and then the updated cache data corresponding to the data request can be sent to the data requester.

[0060] The cache data processing method provided in the embodiment of the present application carries an acceptable data validity period in the data request sent by the data requester, and uses the acceptable data validity period to participate in the processing of whether the cache data in the cache is valid, that is, the validity period of the cache data in the cache is determined according to the acceptable data validity period carried by the data request, so that the data requester determines the validity period of the cache data in the cache. If it is determined that the target cache data corresponding to the data request within the acceptable data validity period exists in the cache, the target cache data is obtained from the cache and sent to the data requester; if it is determined that the target cache data corresponding to the data request within the acceptable data validity period does not exist in the cache, the cache data in the cache is updated, and the updated cache data corresponding to the data request is sent to the data requester. This can solve the problem of different cache validity periods in different business scenarios, effectively reduce the frequency of access to source data, and improve cache usage efficiency.

[0061] Figure 3 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 2 Based on the above embodiments, the present application further describes the cache data processing method. Figure 3 As shown, the method of the embodiment of the present application may include:

[0062] S301: Receive a data request sent by a data requester, where the data request carries an acceptable data validity period.

[0063] The detailed description of this step can be found in Figure 2 The relevant description of S201 in the illustrated embodiment, for example, receives a data request sent by a data requester, parses the data request, and obtains an acceptable data validity period carried by the data request. The data request may also carry other request information corresponding to the business scenario. The embodiment of the present application does not limit other request information.

[0064] In the embodiment of the present application, Figure 2 The step S202 may further include the following three steps S302 to S304:

[0065] S302: Obtain storage duration of the cached data according to the current time and the storage time corresponding to the cached data in the cache.

[0066] In this step, after obtaining the acceptable data validity period carried by the data request, the storage duration of the cached data in the cache can be compared with the acceptable data validity period to determine whether there is target cached data in the cache corresponding to the data request within the acceptable data validity period. Therefore, in this step, the storage duration of the cached data can be obtained based on the current time and the storage time corresponding to the cached data in the cache, that is, the storage duration of the cached data can be obtained based on the time difference between the current time and the storage time corresponding to the cached data in the cache. For example, the storage duration of the cached data obtained is the cached data within the past 1 hour.

[0067] S303: If the storage duration is less than or equal to the acceptable data validity period, it is determined that there is target cache data corresponding to the data request within the acceptable data validity period in the cache, and step S305 is executed.

[0068] Exemplarily, after obtaining the storage duration of the cached data, the storage duration can be compared with the acceptable data validity period. For example, if the storage duration is the past 30 minutes, and the acceptable data validity period is the past 1 hour, it can be determined that the storage duration is less than the acceptable data validity period, and therefore, it can be determined that the target cached data corresponding to the data request within the acceptable data validity period exists in the cache. It can be understood that when the storage duration of the cached data in the cache is less than or equal to the acceptable data validity period, it can be determined that the target cached data corresponding to the data request within the acceptable data validity period exists in the cache, and the target cached data can be directly obtained from the cache.

[0069] S304: If the storage duration is longer than the acceptable data validity period, it is determined that there is no target cache data corresponding to the data request within the acceptable data validity period in the cache, and steps S306 and S307 are executed.

[0070] Exemplarily, after obtaining the storage duration of the cached data, the storage duration can be compared with the acceptable data validity period. For example, if the storage duration is the past 2 hours, and the acceptable data validity period is the past 1 hour, it can be determined that the storage duration is greater than the acceptable data validity period, and therefore, it can be determined that the target cached data corresponding to the data request within the acceptable data validity period does not exist in the cache, that is, the target cached data cannot be directly obtained from the cache.

[0071] S305: Obtain target cache data from the cache, and send the target cache data to the data requester.

[0072] The detailed description of this step can be found in Figure 2 The relevant description of S203 in the illustrated embodiment is, for example, that after determining that there is target cache data corresponding to the data request within an acceptable data validity period in the cache, the target cache data can be directly obtained from the cache and sent to the data requester.

[0073] S306: Obtain all source data from the source data holder corresponding to the cache, update all source data to the cache, and record the storage time of all source data in the cache.

[0074] Exemplarily, when it is determined that the target cache data corresponding to the data request does not exist in the cache within the acceptable data validity period, that is, it is impossible to directly obtain valid cache data from the cache, therefore, all source data can be obtained from the source data holder corresponding to the cache, and all source data can be updated to the cache to achieve a full update of the cache data; and the storage time of all source data in the cache is recorded for comparison with the acceptable data validity period carried by the next data request. It can be understood that the data request sent by the data requester triggers the update of the cache data in the cache.

[0075] For updating cached data, step S306 is a possible implementation method. In another possible implementation method, updating the cached data in the cache in step S203 may include: obtaining target source data whose storage time is greater than the acceptable data validity period from the source data holder corresponding to the cache, updating the target source data to the cache, and recording the storage time of the target source data in the cache.

[0076] Exemplarily, cached data whose storage duration is longer than the acceptable data validity period can be determined, so that target source data whose storage duration is longer than the acceptable data validity period can be obtained from the source data holder corresponding to the cache, and the target source data can be updated to the cache, thereby achieving an update of part of the cached data; and the storage time of the target source data in the cache is recorded for comparison with the acceptable data validity period carried by the next data request.

[0077] S307: Send the updated cache data corresponding to the data request to the data requester.

[0078] In this step, after all source data are updated to the cache, the updated cache data corresponding to the data request can be obtained from the cache, and the updated cache data corresponding to the data request can be sent to the data requester. Accordingly, after receiving the updated cache data corresponding to the data request, the data requester can apply the updated cache data to the corresponding business scenario.

[0079] Based on the above steps, for example, in the prior art, the validity period of the cached data in the cache is set to 1 hour. If a data request sent by the data requester is received within 1 hour, the prior art and the cached data processing method of the embodiment of the present application have the same performance, both of which obtain the target cached data corresponding to the data request from the cache and send the target cached data to the data requester. If a data request sent by the data requester is received after 1 hour, and the data request can accept cached data within the past 2 hours, for the prior art, since the validity of the cached data in the cache is set to 1 hour, at this time, the source data will be obtained from the source data holder corresponding to the cache, thereby updating the cached data in the cache, and sending the updated cached data corresponding to the data request to the data requester; and for the cached data processing method of the embodiment of the present application, since the validity period of the acceptable data carried by the data request (that is, the cached data within the past 2 hours can be accepted) is used to determine whether the cached data in the cache is valid, the target cached data corresponding to the data request is still obtained from the cache, and the target cached data is sent to the data requester, without the need to update the cached data in the cache. Through the above comparison, it can be seen that the cached data processing method of the embodiment of the present application rarely makes requests for source data, which can improve the efficiency of cache use.

[0080] In addition, the prior art can adjust the validity period of the cached data in the cache to 2 hours, thereby maintaining the same usage efficiency as the cached data processing method of the embodiment of the present application, but it cannot meet the needs of the data requester who wants to obtain data updated within 1 hour. The prior art can also cache data separately for different business scenarios, but in comparison, it will lead to the use of additional cache space, while the cached data processing method of the embodiment of the present application will not increase the use of additional cache space.

[0081] The cache data processing method provided in the embodiment of the present application carries an acceptable data validity period in the data request sent by the data requester, and uses the acceptable data validity period to participate in the processing of whether the cache data in the cache is valid, so that the data requester can determine the validity period of the cache data in the cache. Among them, the storage time of the cache data is compared with the acceptable data validity period. If the storage time is less than or equal to the acceptable data validity period, it is determined that there is target cache data within the acceptable data validity period corresponding to the data request in the cache, the target cache data is obtained from the cache, and the target cache data is sent to the data requester; if the storage time is greater than the acceptable data validity period, it is determined that there is no target cache data within the acceptable data validity period corresponding to the data request in the cache, all source data are obtained from the source data holder corresponding to the cache, all source data are updated to the cache, and the storage time of all source data in the cache is recorded, and the updated cache data corresponding to the data request is sent to the data requester, which can solve the problem of different validity periods of the cache in different business scenarios, effectively reduce the access frequency to the source data, improve the efficiency of cache use, and will not increase the use of additional cache space.

[0082] Based on the above embodiments, Figure 4 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 3 .like Figure 4 As shown, the method of the embodiment of the present application includes:

[0083] S401: The data request module sends a data request to the data cache module, where the data request carries an acceptable data validity period.

[0084] Correspondingly, the data cache module receives the data request sent by the data request module.

[0085] S402: The data cache module determines whether there is target cache data corresponding to the data request within an acceptable data validity period in the cache. If so, the target cache data is obtained from the cache.

[0086] S403: The data cache module sends the target cache data to the data requester.

[0087] Accordingly, the data requester receives the target cache data.

[0088] Based on the above embodiments, Figure 5 Schematic diagram of the process of the cache data processing method provided in the embodiment of the present application Figure 4 .like Figure 5 As shown, the method of the embodiment of the present application includes:

[0089] S501: The data request module sends a data request to the data cache module, where the data request carries an acceptable data validity period.

[0090] Correspondingly, the data cache module receives the data request sent by the data request module.

[0091] S502: The data cache module determines whether there is target cache data corresponding to the data request within an acceptable data validity period in the cache. If not, execute S503: send a request message for obtaining all source data to the source data module.

[0092] Correspondingly, the source data module receives a request message sent by the data cache module for acquiring all source data.

[0093] S504: The source data module obtains all source data.

[0094] S505: The source data module sends all source data to the data cache module.

[0095] Correspondingly, the data cache module receives all source data sent by the source data module.

[0096] S506: The data cache module updates all source data into the cache and records the storage time of all source data in the cache.

[0097] S507: The data cache module sends the updated cache data corresponding to the data request to the data request module.

[0098] for Figure 4 and Figure 5 It can be understood that the key to the embodiment shown is that when the data request module sends a data request to the data cache module, it adds a parameter of acceptable data validity period in the data request. The data cache module determines whether the cached data is valid based on this parameter rather than the parameters solidified inside the data cache module. This can solve the problem of different cache validity periods in different business scenarios, effectively reduce the frequency of access to source data, and improve cache usage efficiency.

[0099] The following is an embodiment of the device of the present application, which can be used to execute the embodiment of the method of the present application. For details not disclosed in the embodiment of the device of the present application, please refer to the embodiment of the method of the present application.

[0100] Figure 6 This is a schematic diagram of the structure of a cache data processing device provided in an embodiment of the present application. Figure 6 As shown, the cache data processing device 600 of the embodiment of the present application includes: a receiving module 601, a determining module 602 and a processing module 603. Among them:

[0101] The receiving module 601 is used to receive a data request sent by a data requester, where the data request carries an acceptable data validity period.

[0102] The determination module 602 is used to determine whether there is target cache data corresponding to the data request within an acceptable data validity period in the cache.

[0103] Processing module 603 is used to obtain the target cache data from the cache if yes, and send the target cache data to the data requester; if no, update the cache data in the cache, and send the updated cache data corresponding to the data request to the data requester.

[0104] In some embodiments, the determination module 602 can be specifically used to: obtain the storage duration of the cached data based on the current time and the storage time corresponding to the cached data in the cache; if the storage duration is less than or equal to the acceptable data validity period, determine that there is target cached data within the acceptable data validity period corresponding to the data request in the cache; if the storage duration is greater than the acceptable data validity period, determine that there is no target cached data within the acceptable data validity period corresponding to the data request in the cache.

[0105] Optionally, when the processing module 603 is used to update the cached data in the cache, it can be specifically used to: obtain all source data from the source data holder corresponding to the cache, update all source data to the cache, and record the storage time of all source data in the cache.

[0106] Optionally, when the processing module 603 is used to update the cached data in the cache, it can be specifically used to: obtain target source data whose storage time is greater than the acceptable data validity period from the source data holder corresponding to the cache, update the target source data to the cache, and record the storage time of the target source data in the cache.

[0107] In some embodiments, the acceptable data validity period is set by the data requester according to different business scenarios, and the acceptable data validity periods carried by different data requests may be the same or different.

[0108] Optionally, the processing module 603 may also be configured to: before receiving a data request sent by a data requester, maintain cached data in the cache.

[0109] The cache data processing device of the embodiment of the present application can be used to execute the technical solution of any of the above-mentioned method embodiments. Its implementation principle and technical effect are similar and will not be repeated here.

[0110] Figure 7 This is a schematic diagram of the structure of an electronic device provided by an embodiment of the present application. Figure 7 As shown, the electronic device 700 may include: at least one processor 701 and a memory 702 .

[0111] The memory 702 is used to store programs. Specifically, the programs may include program codes, and the program codes include computer-executable instructions.

[0112] The memory 702 may include a high-speed random access memory (RAM), and may also include a non-volatile memory (non-volatile memory), such as at least one disk memory.

[0113] The processor 701 is used to execute the computer-executable instructions stored in the memory 702 to implement the cache data processing method described in the aforementioned method embodiment. Among them, the processor 701 may be a central processing unit (CPU), or an application-specific integrated circuit (ASIC), or one or more integrated circuits configured to implement the embodiments of the present application. Specifically, when implementing the cache data processing method described in the aforementioned method embodiment, the electronic device may be, for example, an electronic device with processing functions such as a server.

[0114] Optionally, the electronic device 700 may further include a communication interface 703. In a specific implementation, if the communication interface 703, the memory 702 and the processor 701 are implemented independently, the communication interface 703, the memory 702 and the processor 701 may be interconnected through a bus and communicate with each other. The bus may be an Industry Standard Architecture (ISA) bus, a Peripheral Component (PCI) bus or an Extended Industry Standard Architecture (EISA) bus, etc. The bus may be divided into an address bus, a data bus, a control bus, etc., but it does not mean that there is only one bus or one type of bus.

[0115] Optionally, in a specific implementation, if the communication interface 703, the memory 702 and the processor 701 are integrated on a chip, the communication interface 703, the memory 702 and the processor 701 can communicate through an internal interface.

[0116] The electronic device is used to execute the cache data processing method in any of the aforementioned method embodiments, and its implementation principle and technical effects are similar and will not be repeated here.

[0117] The present application also provides a computer-readable storage medium, in which computer program instructions are stored. When a processor executes the computer program instructions, the above cache data processing method is implemented.

[0118] The present application also provides a computer program product, including a computer program, which implements the above cache data processing method when executed by a processor.

[0119] The computer-readable storage medium mentioned above may be implemented by any type of volatile or non-volatile storage device or a combination thereof, such as static random access memory (SRAM), electrically erasable programmable read-only memory (EEPROM), erasable programmable read-only memory (EPROM), programmable read-only memory (PROM), read-only memory (ROM), magnetic memory, flash memory, magnetic disk or optical disk. The readable storage medium may be any available medium that can be accessed by a general or special-purpose computer.

[0120] An exemplary readable storage medium is coupled to a processor so that the processor can read information from the readable storage medium and write information to the readable storage medium. Of course, the readable storage medium can also be a component of the processor. The processor and the readable storage medium can be located in a dedicated integrated circuit. Of course, the processor and the readable storage medium can also exist as discrete components in a cache data processing device.

[0121] The division of units is only a logical function division, and there may be other divisions in actual implementation, such as multiple units or components can be combined or integrated into another system, or some features can be ignored or not executed. Another point is that the mutual coupling or direct coupling or communication connection shown or discussed can be an indirect coupling or communication connection through some interface, device or unit, which can be electrical, mechanical or other forms.

[0122] The units described as separate components may or may not be physically separated, and the components shown as units may or may not be physical units, that is, they may be located in one place or distributed on multiple network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.

[0123] In addition, each functional unit in each embodiment of the present application may be integrated into one processing unit, or each unit may exist physically separately, or two or more units may be integrated into one unit.

[0124] If the function is implemented in the form of a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of the present application, or the part that contributes to the prior art or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium, including a number of instructions to enable a computer device (which can be a personal computer, server, or network device, etc.) to execute all or part of the steps of the various embodiments of the present application. The aforementioned storage medium includes: U disk, mobile hard disk, read-only memory, random access memory (Random Access Memory, RAM), disk or optical disk, etc., various media that can store program codes.

[0125] Those skilled in the art can understand that all or part of the steps of implementing the above-mentioned method embodiments can be completed by hardware related to program instructions. The aforementioned program can be stored in a computer-readable storage medium. When the program is executed, the steps of the above-mentioned method embodiments are executed; and the aforementioned storage medium includes: ROM, RAM, disk or optical disk and other media that can store program codes.

[0126] Finally, it should be noted that those skilled in the art will readily conceive of other embodiments of the present application after considering the specification and practicing the invention disclosed herein. The present application is intended to cover any variations, uses or adaptations of the present application, which follow the general principles of the present application and include common knowledge or customary technical means in the art that are not disclosed in the present application, are not limited to the precise structures described above and shown in the drawings, and may be modified and changed in various ways without departing from the scope thereof. The scope of the present application is limited only by the appended claims.

Claims

1. A cache data processing method, characterized in that: include: Receiving a data request sent by a data requester, wherein the data request carries an acceptable data validity period; Determine whether there is target cache data corresponding to the data request within the acceptable data validity period in the cache; If yes, obtaining the target cache data from the cache and sending the target cache data to the data requester; If not, the cached data in the cache is updated, and the updated cached data corresponding to the data request is sent to the data requester.

2. The cache data processing method according to claim 1, characterized in that: The determining whether there is target cache data corresponding to the data request within the acceptable data validity period in the cache includes: Obtaining the storage duration of the cached data according to the current time and the storage time corresponding to the cached data in the cache; If the storage duration is less than or equal to the acceptable data validity period, determining that target cache data corresponding to the data request and within the acceptable data validity period exists in the cache; If the storage duration is longer than the acceptable data validity period, it is determined that the target cache data corresponding to the data request and within the acceptable data validity period does not exist in the cache.

3. The cache data processing method according to claim 2, characterized in that: The updating of cached data in the cache includes: Acquire all source data from the source data holder corresponding to the cache, update all source data to the cache, and record the storage time of all source data in the cache.

4. The cache data processing method according to claim 2, characterized in that: The updating of cached data in the cache includes: Obtain the target source data whose storage duration is longer than the acceptable data validity period from the source data holder corresponding to the cache, update the target source data to the cache, and record the storage time of the target source data in the cache.

5. The cache data processing method according to any one of claims 1 to 4, characterized in that: The acceptable data validity period is set by the data requester according to different business scenarios, and the acceptable data validity periods carried by different data requests may be the same or different.

6. The cache data processing method according to any one of claims 1 to 4, characterized in that: Before receiving the data request sent by the data requester, the method further includes: The cache data in the cache is maintained.

7. A cache data processing device, characterized in that: include: A receiving module, configured to receive a data request sent by a data requester, wherein the data request carries an acceptable data validity period; A determination module, used to determine whether there is target cache data corresponding to the data request within the acceptable data validity period in the cache; a processing module, configured to, if yes, obtain the target cache data from the cache, and send the target cache data to the data requester; If not, the cached data in the cache is updated, and the updated cached data corresponding to the data request is sent to the data requester.

8. The cache data processing device according to claim 7, characterized in that: The determination module is specifically used for: Obtaining the storage duration of the cached data according to the current time and the storage time corresponding to the cached data in the cache; If the storage duration is less than or equal to the acceptable data validity period, determining that target cache data corresponding to the data request and within the acceptable data validity period exists in the cache; If the storage duration is longer than the acceptable data validity period, it is determined that the target cache data corresponding to the data request and within the acceptable data validity period does not exist in the cache.

9. An electronic device, characterized in that: include: A processor, and a memory communicatively connected to the processor; The memory stores computer-executable instructions; The processor executes the computer-executable instructions stored in the memory to implement the cache data processing method according to any one of claims 1 to 6.

10. A computer-readable storage medium, characterized in that: The computer-readable storage medium stores computer-executable instructions, and when the computer-executable instructions are executed, they are used to implement the cache data processing method according to any one of claims 1 to 6.

Citation Information

Patent Citations

  • Caching method, equipment and system for Internet of Things

    CN105472661A

  • Cache-based data access method and apparatus

    CN106599721A

  • Data caching method and device and computer-readable storage medium

    CN106844784A

  • Method and device of data communication, computer equipment and storage medium

    CN108153812A

  • Intelligent data caching method and device, computer equipment and storage medium

    CN111046070A