Data caching method, device, electronic device and computer readable medium
By receiving and sorting request information, data cache is automatically cached according to the popularity level, which solves the problem of cache prediction in the prior art that it is difficult to deal with traffic peaks, and achieves the effect of high hit rate and low server pressure.
Patent Information
- Application Number
- CN202010106478.8
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- Filing Date
- 2020-02-21
- Publication Date
- 2025-01-14
- Estimated Expiration
- 2040-02-21
AI Technical Summary
In the prior art, cache predictions are difficult to accurately deal with traffic flood peaks, resulting in low cache hit rate and unable to effectively reduce back-end server pressure.
By receiving and sorting request information, the popularity level of the request information is determined based on the visit volume and popularity growth rate, data cache is automatically cached, cache validity periods for different popularity levels, and data is stored in local and external cache modules to achieve high hit rate cache.
Improve cache hit rate, can deal with traffic peaks more accurately, reduce the pressure on the backend server, and ensure efficient data access.
Smart Images

Figure CN112286965B_ABST
Abstract
Description
Technical Field
[0001] The present disclosure relates to the field of storage technology, and in particular to a data caching method, device, electronic device, and computer-readable medium. Background Art
[0002] The use of cache is very common in Internet systems. It can solve the problem of backend system penetration when the traffic is large. When dealing with large traffic, if the data content can be cached in advance, the huge pressure on the backend server can be reduced.
[0003] Currently, popular content is manually predicted and cached in advance. However, this method requires that all content be known in advance to accurately predict the popularity of various content. However, the above conditions are difficult to achieve, which will lead to cache prediction errors, low cache hit rate, and inability to accurately respond to traffic peaks.
[0004] Therefore, a new data caching method, device, electronic device and computer-readable medium are needed.
[0005] The above information disclosed in this Background section is only for enhancement of understanding of the background of the present disclosure and therefore it may contain information that does not constitute the prior art that is already known to one of ordinary skill in the art. Summary of the invention
[0006] In view of this, the embodiments of the present disclosure provide a data caching method, device, electronic device and computer-readable medium, thereby avoiding, at least to a certain extent, the defects of the related art such as low cache hit rate and inability to accurately respond to traffic peaks.
[0007] Other features and advantages of the present disclosure will become apparent from the following detailed description, or may be learned in part by the practice of the present disclosure.
[0008] According to the first aspect of an embodiment of the present disclosure, a data caching method is proposed, which includes: receiving at least one request information of a target object; sorting the at least one request information according to the number of visits; obtaining heat level information of each request information in the at least one request information according to the sorting result; and storing data information corresponding to each request information in a cache module corresponding to the target object according to the heat level information of each request information.
[0009] In an exemplary embodiment of the present disclosure, obtaining the heat level information of each request information in the at least one request information according to the sorting result includes: determining the first heat information and the heat growth rate of each request information according to the sorting result; predicting each request information according to the first heat information and the heat growth rate of each request information to obtain the second heat information of each request information; determining the heat level information of each request information according to the second heat information of each request information.
[0010] In an exemplary embodiment of the present disclosure, determining the heat level information of each request information according to the second heat information of each request information includes: determining the heat level information of the request information whose second heat information is greater than a first threshold as a first heat level; determining the heat level information of the request information whose second heat information is less than or equal to the first threshold as a second heat level.
[0011] In an exemplary embodiment of the present disclosure, the data information corresponding to each request information is stored in a cache module corresponding to the target object according to the heat level information of each request information, including: determining the data key value information corresponding to each request information according to the request and data mapping table; reading in a database according to the data key value information corresponding to each request information to obtain the data information corresponding to each request information; determining the heat level information of each request information as the heat level information of the data information corresponding to each request information; determining the cache validity period of the data information corresponding to each request information according to the heat level information of the data information corresponding to each request information; storing the data information corresponding to each request information in the cache module corresponding to the target object according to the cache validity period of the data information corresponding to each request information.
[0012] In an exemplary embodiment of the present disclosure, the cache validity period of the data information corresponding to each request information is determined according to the heat level information of the data information corresponding to each request information, including: determining that the cache validity period of the data information whose heat level information is a first heat level is a first effective period; determining that the cache validity period of the data information whose heat level information is a second heat level is a second effective period, the second effective period is less than the first effective period, and the access volume of the data information of the first heat level is greater than the access volume of the data information of the second heat level.
[0013] In an exemplary embodiment of the present disclosure, the data information corresponding to each request information is stored in the cache module corresponding to the target object according to the cache validity period of the data information corresponding to each request information, including: storing the data information with heat level information of the first heat level in the local cache module and the external cache module corresponding to the target object according to its cache validity period; storing the data information with heat level information of the second heat level in the external cache module corresponding to the target object according to its cache validity period.
[0014] In an exemplary embodiment of the present disclosure, the method also includes: receiving target request information of the target object; reading and obtaining target data information in the local cache module or the external cache module corresponding to the target object according to the target request information, and updating the cache validity period of the target data information; if the reading fails, reading the target data information in the database according to the target request information, and caching the target data information in the local cache module and the external cache module corresponding to the target object.
[0015] According to the second aspect of an embodiment of the present disclosure, a data caching device is proposed, which includes: a request receiving module, configured to receive at least one request information of a target object; a request sorting module, configured to sort the at least one request information according to the number of visits; a heat level module, configured to obtain heat level information of each request information in the at least one request information according to the sorting result; and a data caching module, configured to store data information corresponding to each request information in a cache module corresponding to the target object according to the heat level information of each request information.
[0016] According to the third aspect of an embodiment of the present disclosure, an electronic device is proposed, which includes: one or more processors; a storage device for storing one or more programs; when the one or more programs are executed by the one or more processors, the one or more processors implement any of the data caching methods described above.
[0017] According to a fourth aspect of an embodiment of the present disclosure, a computer-readable medium is provided, on which a computer program is stored, and when the program is executed by a processor, the data caching method as described in any one of the above items is implemented.
[0018] According to the data caching method, device, electronic device and computer-readable medium provided in certain embodiments of the present disclosure, the request information is sorted according to the access volume and the heat level information of the request information is obtained. The request information can be heat analyzed to determine the heat level information of the request information, and the data information corresponding to the request information can be cached according to the heat level information. A high hit rate cache can be achieved to cope with traffic peaks and reduce the pressure on the back-end server.
[0019] It is to be understood that the foregoing general description and the following detailed description are exemplary only and are not restrictive of the present disclosure. BRIEF DESCRIPTION OF THE DRAWINGS
[0020] The drawings herein are incorporated into the specification and constitute a part of the specification, illustrate embodiments consistent with the present disclosure, and together with the specification are used to explain the principles of the present disclosure. The drawings described below are only some embodiments of the present disclosure, and for ordinary technicians in this field, other drawings can also be obtained based on these drawings without creative work.
[0021] Figure 1 is a system block diagram of a data caching method and device according to an exemplary embodiment;
[0022] Figure 2 is a flow chart of a data caching method according to an exemplary embodiment;
[0023] Figure 3 is a flow chart of a data caching method according to an exemplary embodiment;
[0024] Figure 4 is a flow chart of a data caching method according to an exemplary embodiment;
[0025] Figure 5 is a flow chart of a data caching method according to an exemplary embodiment;
[0026] Figure 6 is a flow chart of a data caching method according to an exemplary embodiment;
[0027] Figure 7 is a flow chart of a data caching method according to an exemplary embodiment;
[0028] Figure 8 is a flow chart of a data caching method according to an exemplary embodiment;
[0029] Fig. 9 is a flow chart of a data caching method according to another exemplary embodiment;
[0030] Fig.10 is a block diagram of a data cache device according to an exemplary embodiment;
[0031] Fig.11 is a block diagram of a data cache system according to an exemplary embodiment;
[0032] Fig.12is a block diagram of an electronic device according to an exemplary embodiment;
[0033] Fig.13 A schematic diagram of a computer-readable storage medium in an exemplary embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION
[0034] Example embodiments will now be described more fully with reference to the accompanying drawings. However, example embodiments can be implemented in many forms and should not be construed as limited to the embodiments set forth herein; rather, these embodiments are provided so that the present invention will be comprehensive and complete and fully convey the concepts of the example embodiments to those skilled in the art. The same reference numerals in the figures represent the same or similar parts, and thus their repeated description will be omitted.
[0035] The described features, structures or characteristics may be combined in one or more embodiments in any suitable manner. In the following description, many specific details are provided to provide a full understanding of the embodiments of the present invention. However, those skilled in the art will appreciate that the technical solution of the present invention may be practiced while omitting one or more of the specific details, or other methods, components, devices, steps, etc. may be adopted. In other cases, known methods, devices, implementations or operations are not shown or described in detail to avoid blurring various aspects of the present invention.
[0036] The accompanying drawings are only schematic illustrations of the present invention, and the same reference numerals in the drawings represent the same or similar parts, so their repeated description will be omitted. Some block diagrams shown in the accompanying drawings do not necessarily correspond to physically or logically independent entities. These functional entities can be implemented in software form, or in one or more hardware modules or integrated circuits, or in different networks and / or processor devices and / or microcontroller devices.
[0037] The flowcharts shown in the accompanying drawings are only exemplary and do not necessarily include all the contents and steps, nor must they be executed in the order described. For example, some steps can be decomposed, and some steps can be combined or partially combined, so the actual execution order may change according to actual conditions.
[0038] Exemplary embodiments of the present invention will be described in detail below with reference to the accompanying drawings.
[0039] Figure 1 The present invention is a system block diagram showing a data caching method and device according to an exemplary embodiment.
[0040] The server 105 may be a server that provides various services, such as a background management server (only for example) that provides support for the data cache system operated by the user using the terminal devices 101, 102, and 103. The background management server may analyze and process the received request information and other data, and feed back the processing results (such as data information corresponding to each request information, heat level information of each request information, cache results - only for example) to the terminal device.
[0041] The server 105 may, for example, receive at least one request information of a target object within a preset historical time period; the server 105 may, for example, sort the at least one request information according to the number of visits; the server 105 may, for example, obtain the popularity level information of each request information in the at least one request information according to the sorting result. The server 105 may, for example, store the data information corresponding to each request information in the cache module corresponding to the target object according to the popularity level information of each request information.
[0042] The server 105 may be a physical server, or may be composed of a plurality of servers, a portion of the server 105 may be used as a data cache task submission system in the present disclosure, for obtaining tasks to execute data cache commands; and a portion of the server 105 may be used as a data cache system in the present disclosure, for receiving at least one request information of a target object; sorting the at least one request information according to the number of visits; obtaining heat level information of each request information in the at least one request information according to the sorting result; and storing the data information corresponding to each request information in the cache module corresponding to the target object according to the heat level information of each request information.
[0043] Figure 2 1 is a flowchart of a data caching method according to an exemplary embodiment. The data caching method provided in the embodiment of the present disclosure can be executed by any electronic device with computing and processing capabilities, such as terminal devices 101, 102, 103 and / or server 105. In the following embodiments, the server executing the method is used as an example for illustration, but the present disclosure is not limited to this. The data caching method 20 provided in the embodiment of the present disclosure may include steps S202 to S208.
[0044] like Figure 2 As shown, in step S202, at least one request information of a target object is received.
[0045] In the embodiment of the present disclosure, the target object may be, for example, an application server of a specified application. Among them, at least one request information of the target object within a preset historical time period may be received. The preset historical time period may be set according to the actual request, and the present disclosure does not specifically limit this. The at least one request information of the target object within the preset historical time period may be stored in a database. For example, the request information of the target object may be subscribed to so that the received request information is stored in the database, so that the at least one request information of the target object within the preset historical time period is read in the database in this step.
[0046] In step S204, at least one piece of request information is sorted according to the number of visits.
[0047] In the disclosed embodiment, at least one request information may be sorted according to the number of visits of each request information in the at least one request information to obtain the popularity information of each request information in a preset historical time period, that is, the first popularity information.
[0048] In an exemplary embodiment, the growth rate of each request information within a preset unit time can also be obtained according to the sorting result. The preset unit time can be, for example, 10 seconds, 1 minute, etc., and the present disclosure does not specifically limit this. According to the growth rate of each request information within the preset unit time, the predicted heat information of each request information in the future preset time period, i.e., the second heat information, is determined.
[0049] In step S206, the heat level information of each request information in the at least one request information is obtained according to the sorting result.
[0050] In the disclosed embodiment, the heat level information of each request information can be determined based on the numerical value of the heat information of each request information obtained according to the sorting result. The heat level information may include a first heat level and a second heat level. The heat information of the request information of the first heat level is greater than the request information of the second heat level. Alternatively, the heat level information may also include a third heat level, and the heat information of the request information of the second heat level is greater than the request information of the third heat level. The disclosed embodiment does not specifically limit the specific number of heat level information.
[0051] In step S208, data information corresponding to each request information is stored in a cache module corresponding to the target object according to the heat level information of each request information.
[0052] In the embodiment of the present disclosure, the cache module corresponding to the target object may include a distributed cache module of the target object. For example, when the target object is an application server, the distributed cache module of the target object may be a distributed cache module corresponding to the application server. The cache module corresponding to the target object may also include a local cache module of the target object. When the target object is an application server, the local cache module of the target object may be local to the application server.
[0053] In the disclosed embodiment, the cache validity period of the data information corresponding to each request information can be determined according to the heat level information of each request information, and the data information corresponding to each request information can be stored in the cache module corresponding to the target object according to the cache validity period.
[0054] According to the data caching method provided in the embodiment of the present disclosure, the request information is sorted according to the access volume and the heat level information of the request information is obtained. The request information can be heat analyzed to determine the heat level information of the request information, and the data information corresponding to the request information can be cached according to the heat level information. A high hit rate cache can be achieved to cope with traffic peaks and reduce the pressure on the back-end server.
[0055] Figure 3 The flowchart of a data caching method according to an exemplary embodiment is shown. The data caching method 30 provided in the embodiment of the present disclosure may include steps S302 to S306.
[0056] like Figure 3 As shown, in step S302, the first heat information and heat growth rate of each request information are determined according to the sorting result.
[0057] In the embodiment of the present disclosure, the first heat information of each request information may be the heat information of each request information within a preset historical time period. The heat growth rate may be the growth rate of the first heat information of each request information within a preset unit time. Among them, the first heat information of each request information may be divided according to the preset unit time to determine the growth rate information of the first heat information of each request information within the preset unit time. The preset unit time may be, for example, 10 seconds, 1 minute, etc., and the present disclosure does not make any special limitation on this.
[0058] In step S304, each request information is predicted according to the first heat information and the heat growth rate of each request information to obtain the second heat information of each request information.
[0059] In the disclosed embodiment, the predicted heat information of each request information within a preset time period in the future, that is, the second heat information, can be determined according to the heat growth rate of each request information.
[0060] In step S306, the heat level information of each request information is determined according to the second heat information of each request information.
[0061] In the disclosed embodiment, the heat level of each request information can be determined according to the numerical value of the second heat information of each request information. The heat level information may include a first heat level and a second heat level. The heat information of the request information of the first heat level is greater than the request information of the second heat level. Alternatively, the heat level information may also include a third heat level, and the heat information of the request information of the second heat level is greater than the request information of the third heat level. The disclosed embodiment does not specifically limit the specific number of heat level information.
[0062] Steps S302 to S306 of the embodiment of the present disclosure may be used as Figure 2 An alternative step of step S206 in the embodiment.
[0063] According to the data caching method provided in the embodiment of the present disclosure, each request information can be predicted according to the heat growth rate to obtain the second heat information, and the heat trend prediction analysis can be realized. Then, the heat level information of each request information can be determined according to the analysis result (second heat information), thereby realizing the heat prediction and classification of the request information.
[0064] Figure 4 4 is a flowchart of a data caching method according to an exemplary embodiment. The data caching method 40 provided in the embodiment of the present disclosure may include steps S402 to S404.
[0065] like Figure 4 As shown, in step S402, the heat level information of the request information whose second heat information is greater than the first threshold is determined as the first heat level.
[0066] In step S404, the heat level information of the request information whose second heat level information is less than or equal to the first threshold is determined as the second heat level.
[0067] In an exemplary embodiment, if the heat level information also includes a third heat level, the heat level information of the request information whose second heat information is less than or equal to the first threshold and greater than the second threshold can also be determined as the second heat level, wherein the first threshold is greater than the second threshold; and the heat level information of the request information whose second heat information is less than or equal to the second threshold can be determined as the third heat level.
[0068] Steps S402 to S404 of the embodiment of the present disclosure may be used as Figure 3 An alternative step of step S306 in the embodiment.
[0069] According to the data caching method provided by the embodiment of the present disclosure, the heat level information of the requested information can be determined according to the numerical value of the second heat information to achieve heat grading of the requested information.
[0070] Figure 5 The flowchart of a data caching method according to an exemplary embodiment is shown. The data caching method 50 provided in the embodiment of the present disclosure may include steps S502 to S510.
[0071] like Figure 5 As shown, in step S502, data key information corresponding to each request information is determined according to the request and data mapping table.
[0072] In the disclosed embodiment, the request and data mapping table describes a mapping table of key values of request information and data information corresponding to the request information in the database. Each request information can be used as an index to search in the request and data mapping table to determine the data key value information corresponding to each request information. The database is a non-cache module, which stores at least one data information corresponding to at least one request information.
[0073] In step S504, data key information corresponding to each request information is read from the database to obtain data information corresponding to each request information.
[0074] In step S506, the heat level information of each request information is determined as the heat level information of the data information corresponding to each request information.
[0075] In the disclosed embodiment, the heat level information of each request information may be in the form of a list. By replacing the request information corresponding column in the list with the data information corresponding to each request information, a list of data information and heat level information corresponding to each request information may be obtained.
[0076] In step S508, the cache validity period of the data information corresponding to each request information is determined according to the heat level information of the data information corresponding to each request information.
[0077] In step S510, the data information corresponding to each request information is stored in a cache module corresponding to the target object according to the cache validity period of the data information corresponding to each request information.
[0078] In the implementation of the present disclosure, the cache module corresponding to the target object may be a distributed cache module corresponding to the target object, wherein the content validity period in the cache module may be set according to the cache validity period of the data information corresponding to each request information.
[0079] Steps S502 to S510 of the embodiment of the present disclosure may be used as Figure 2An alternative step of step S208 in the embodiment.
[0080] The data caching method provided by the embodiment of the present disclosure can determine the heat level information of the data information corresponding to each request information based on the request and data mapping table. Then, the cache validity period of the data information corresponding to each request information can be determined according to the heat level information of the data information corresponding to each request information, so as to realize the hierarchical caching of the data information corresponding to each request information in the cache module, so as to realize the data caching with high hit rate and ensure the rapid calling of the target object.
[0081] Figure 6 6 is a flow chart showing a data caching method according to an exemplary embodiment. The data caching method 60 provided in the embodiment of the present disclosure may include steps S602 to S604.
[0082] like Figure 6 As shown, in step S602, it is determined that the cache validity period of the data information with the heat level information being the first heat level is the first effective duration.
[0083] In step S604, it is determined that the cache validity period of the data information with the second heat level is the second effective duration, the second effective duration is shorter than the first effective duration, and the access volume of the data information of the first heat level is greater than the access volume of the data information of the second heat level.
[0084] In the embodiment of the present disclosure, the number of visits to the data information of the first heat level is the first heat information or the second heat information of the request information corresponding to the data information. The specific calculation method of the first heat information or the second heat information can be seen Figure 3 Step S302 or step S302 to step S304.
[0085] In an exemplary embodiment, if the heat level information further includes a third heat level, the cache validity period of the data information with the third heat level may be determined to be a third validity period, which is shorter than the second validity period.
[0086] Steps S602 to S604 of the embodiment of the present disclosure may be used as Figure 5 An alternative step of step S508 in the embodiment.
[0087] The data caching method provided by the embodiment of the present disclosure determines the cache validity period according to the heat level information of the data information, which can ensure that the data information with high heat has a longer cache validity period and the data information with low heat has a shorter cache validity period, so as to realize the hierarchical caching of the data information in the subsequent steps, and avoid the phenomenon that the cache is completely refreshed and penetrates to the back-end server due to the excessive cache rotation amplitude of the data information with high heat.
[0088] Figure 7 1 is a flow chart showing a data caching method according to an exemplary embodiment. The data caching method 70 provided in the embodiment of the present disclosure may include steps S702 to S704.
[0089] like Figure 7 As shown, in step S702, data information with heat level information of the first heat level is stored in the local cache module and the external cache module corresponding to the target object according to its cache validity period.
[0090] In the disclosed embodiment, the external cache module corresponding to the target object may be a distributed cache module.
[0091] In step S704, the data information with the heat level information of the second heat level is stored in the external cache module corresponding to the target object according to its cache validity period.
[0092] Steps S702 to S704 of the embodiment of the present disclosure may be used as Figure 5 An alternative step of step S510 in the embodiment.
[0093] The technical solution provided by the embodiment of the present disclosure stores the data information of the first heat level and the second heat level in the external cache module of the target object according to the cache validity period, which can realize hierarchical cache and ensure the rapid call of high-heat data. Storing the data information of the first heat level in the local cache module of the target object according to the cache validity period can avoid the phenomenon that extremely hot data penetrates to the backend server at the moment of expiration.
[0094] Figure 8 The flowchart of a data caching method according to an exemplary embodiment is shown. The data caching method 80 provided in the embodiment of the present disclosure may include steps S802 to S804.
[0095] like Figure 8 As shown, in step S802, target request information of the target object is received.
[0096] In step S804, target data information is read from a local cache module or an external cache module corresponding to the target object according to the target request information, and the cache validity period of the target data information is updated.
[0097] In the embodiment of the present disclosure, according to Figure 2 Step S206 of the embodiment determines the heat level information of the target data information, and determines the cache validity period of the target data information according to the heat level information of the target data information, so as to update the cache validity period of the target data information in the local cache module or the external cache module.
[0098] In an exemplary embodiment, (1) the target data information can be obtained by reading from a local cache module corresponding to the target object according to the target request information, and the cache validity period of the target data information can be updated; if the reading in step (1) fails, the target data information can be obtained by reading from an external cache module corresponding to the target object according to the target request information, and the cache validity period of the target data information can be updated.
[0099] In step S806, if the reading fails, the target data information is read from the database according to the target request information, and the target data information is cached in the local cache module and the external cache module corresponding to the target object.
[0100] In the embodiment of the present disclosure, when the target data information is cached in the external cache module, the heat level information of the target data information can be set to the second heat level or the third heat level mentioned above, and the cache validity period can be determined according to the heat level information (such as Figure 6 Steps S602 to S604 of the embodiment in the embodiment are performed to cache the target data information into the local cache module and the external cache module corresponding to the target object.
[0101] Steps S802 to S806 of the present embodiment may be followed by Figure 2 Step S208 in the embodiment is used as a subsequent step.
[0102] The data caching method provided by the embodiment of the present disclosure reads the target data information in the local cache module or the external cache module according to the target request information, and updates the cache validity period of the target data information, which can achieve continuous caching of hot data and reduce the data exchange pressure of the back-end server. When the reading fails, the target data information read from the database is cached in the local cache module and the external cache module corresponding to the target object, which can predict and cache the future hot data information to a certain extent to cope with sudden traffic peaks.
[0103] It should be clearly understood that the present disclosure describes how to form and use specific examples, but the principles of the present disclosure are not limited to any details of these examples. On the contrary, based on the teachings of the contents disclosed in the present disclosure, these principles can be applied to many other embodiments.
[0104] Fig. 9 is a flow chart showing a data caching method according to another exemplary embodiment. The data caching method 90 at least includes steps S901 to S911.
[0105] The data caching method of the present disclosure can be applied to Fig.11 In the data cache system. Fig.11As shown, the data cache system may include a proxy server 1110 , a message module 1120 , a big data module 1130 , a cache processing module 1140 , an application server 1150 and a distributed cache module 1160 .
[0106] like Fig. 9 As shown, in step S901, request information is received through a proxy server.
[0107] In the embodiment of the present disclosure, the proxy server may be a reverse proxy server (such as Nginx), but the technical solution of the present disclosure does not specifically limit this.
[0108] In step S902, the subscription request information is received through the big data module.
[0109] In step S903, the application server monitors the cache change notification of the data information of the first heat level of the cache processing module.
[0110] In step S904, the proxy server sends the request information to the application server, generates message information according to the request information, and sends it to the big data processing module via the message module, and executes steps S905 and S908 respectively.
[0111] In step S905, the big data processing module obtains request information according to the message information, and sorts the request information according to the number of visits, and obtains the heat level information of the data information corresponding to each request information according to the sorting result, and the heat level information includes the first heat level, the second heat level and the third heat level.
[0112] In an exemplary embodiment, the present disclosure may employ Figure 3 Steps S302 to S306, Figure 4 Step S402 to step S404, Figure 5 The steps similar to step S502 to step S510 are not repeated here.
[0113] In step S906, data information corresponding to each request information is stored in the distributed cache module according to the cache validity period corresponding to the heat level information.
[0114] In step S907, a cache change notification is generated for the data information with the heat level information being the first heat level and is sent to the application server, so that the application server updates the cache content and cache validity period of the first heat level according to the cache change notification.
[0115] In step S908, target request information is received through the proxy server.
[0116] In step S909, the target data information is read from the local cache module corresponding to the target object according to the target request information, and the cache validity period of the target data information is updated.
[0117] In step S910, if the reading in step S909 fails, the target data information is read from the external cache module corresponding to the target object according to the target request information, and the cache validity period of the target data information is updated.
[0118] In step S911, if the reading in step S910 fails, the target data information is read in the database according to the target request information, the heat level information of the target data information is determined to be the third heat level, and the target data information is cached in the local cache module and the external cache module corresponding to the target object.
[0119] According to the data caching method provided by the embodiment of the present disclosure, request information is obtained in real time and sorted according to the number of visits. The data information corresponding to the request information can be divided into heat levels according to the sorting results, and different cache validity periods can be set according to data information of different heat levels. This can avoid the phenomenon that the cache rotation is too large, the cache is completely refreshed, and penetrates to the back end, and can cope with sudden traffic peaks to quickly update the heat level of the cached data information and ensure the rapid call of high-heat data.
[0120] According to the data caching method provided in the embodiment of the present disclosure, data of the first heat level is sent to the application server for caching, which can avoid the phenomenon that extremely hot data penetrates to the backend server at the moment of failure and reduce the number of requests to the distributed cache server.
[0121] Those skilled in the art will appreciate that all or part of the steps for implementing the above embodiments are implemented as a computer program executed by a central processing unit (CPU). When the computer program is executed by the central processing unit (CPU), the above functions defined by the above method provided by the present disclosure are executed. The program may be stored in a computer-readable storage medium, which may be a read-only memory, a disk or an optical disk, etc.
[0122] In addition, it should be noted that the above figures are only schematic illustrations of the processes included in the method according to the exemplary embodiments of the present disclosure, and are not intended to be limiting. It is easy to understand that the processes shown in the above figures do not indicate or limit the time sequence of these processes. In addition, it is also easy to understand that these processes can be performed synchronously or asynchronously, for example, in multiple modules.
[0123] The following are embodiments of the device disclosed herein, which can be used to execute the method embodiments disclosed herein. For details not disclosed in the device embodiments disclosed herein, please refer to the method embodiments disclosed herein.
[0124] Fig.10 is a block diagram of a data cache device according to an exemplary embodiment. Fig.10 The data caching device 1000 provided in the embodiment of the present disclosure may include: a request receiving module 1010, a request sorting module 1020, a heat level module 1030 and a data caching module 1040.
[0125] In the data cache device 1000 , the request receiving module 1010 may be configured to receive at least one request information of a target object.
[0126] The request sorting module 1020 may be configured to sort the at least one request information according to the access volume.
[0127] The heat level module 1030 may be configured to obtain heat level information of each request information in the at least one request information according to the sorting result.
[0128] In an exemplary embodiment, the heat level module 1030 may include a rate calculation submodule, a heat prediction submodule and a heat level submodule. Among them, the rate calculation submodule may be configured to determine the first heat information and the heat growth rate of each request information according to the sorting result. The heat prediction submodule may be configured to predict each request information according to the first heat information and the heat growth rate of each request information to obtain the second heat information of each request information. The heat level submodule may be configured to determine the heat level information of each request information according to the second heat information of each request information.
[0129] In an exemplary embodiment, the heat level submodule may include a first heat level determination unit and a second heat level determination unit. The first heat level determination unit may be configured to determine the heat level information of the request information whose second heat information is greater than a first threshold as a first heat level. The second heat level determination unit may be configured to determine the heat level information of the request information whose second heat information is less than or equal to the first threshold as a second heat level.
[0130] The data cache module 1040 may be configured to store the data information corresponding to each request information into the cache module corresponding to the target object according to the heat level information of each request information.
[0131] In an exemplary embodiment, the data cache module 1040 may include a key value determination unit, a data reading unit, a heat level determination unit, a cache validity period unit and a data cache unit. Among them, the key value determination unit may be configured to determine the data key value information corresponding to each request information according to the request and data mapping table; the data reading unit may be configured to read in the database according to the data key value information corresponding to each request information, and obtain the data information corresponding to each request information; the heat level determination unit may be configured to determine the heat level information of each request information as the heat level information of the data information corresponding to each request information; the cache validity period unit may be configured to determine the cache validity period of the data information corresponding to each request information according to the heat level information of the data information corresponding to each request information; the data cache unit may be configured to store the data information corresponding to each request information in the cache module corresponding to the target object according to the cache validity period of the data information corresponding to each request information.
[0132] In an exemplary embodiment, the cache validity period unit may include a first validity period subunit and a second validity period subunit. The first validity period subunit may be configured to determine that the cache validity period of data information whose heat level information is a first heat level is a first validity period. The second validity period subunit may be configured to determine that the cache validity period of data information whose heat level information is a second heat level is a second validity period, the second validity period is less than the first validity period, and the access volume of the data information of the first heat level is greater than the access volume of the data information of the second heat level.
[0133] In an exemplary embodiment, the data cache unit may include a local cache subunit and an external cache subunit. The local cache subunit may be configured to store data information with a heat level information of the first heat level in the local cache module and the external cache module corresponding to the target object according to its cache validity period. The external cache subunit may be configured to store data information with a heat level information of the second heat level in the external cache module corresponding to the target object according to its cache validity period.
[0134] In an exemplary embodiment, the data cache device 1000 may also include a target request receiving module, a cache reading module, and a database reading module. Among them, the target request receiving module can be configured to receive the target request information of the target object. The cache reading module can be configured to read the target data information in the local cache module or the external cache module corresponding to the target object according to the target request information, and update the cache validity period of the target data information. And the database reading module can be configured to read the target data information in the database according to the target request information if the reading fails, and store the target data information in the local cache module and the external cache module corresponding to the target object.
[0135] According to the data caching device provided by the embodiment of the present disclosure, the request information is sorted according to the access volume and the heat level information of the request information is obtained. The request information can be heat analyzed to determine the heat level information of the request information, and the data information corresponding to the request information can be cached according to the heat level information, so as to achieve a high hit rate cache to cope with traffic peaks and reduce the pressure on the back-end server.
[0136] Fig.12 It is a block diagram of an electronic device according to an exemplary embodiment.
[0137] Refer to the following Fig.12 The electronic device 200 according to this embodiment of the present disclosure is described. Fig.12 The electronic device 200 shown is merely an example and should not bring any limitation to the functions and scope of use of the embodiments of the present disclosure.
[0138] like Fig.12 As shown, the electronic device 200 is in the form of a general computing device. The components of the electronic device 200 may include, but are not limited to: at least one processing unit 210, at least one storage unit 220, a bus 230 connecting different system components (including the storage unit 220 and the processing unit 210), a display unit 240, etc.
[0139] The storage unit stores a program code, which can be executed by the processing unit 210, so that the processing unit 210 executes the steps according to various exemplary embodiments of the present disclosure described in the electronic prescription circulation processing method section of this specification. For example, the processing unit 210 can execute the following steps: Figure 2 , Figure 3 , Figure 4 , Figure 5 , Figure 6 , Figure 7 , Figure 8 , Fig. 9 Follow the steps shown in .
[0140] The storage unit 220 may include a readable medium in the form of a volatile storage unit, such as a random access memory unit (RAM) 2201 and / or a cache memory unit 2202 , and may further include a read-only memory unit (ROM) 2203 .
[0141] The storage unit 220 may also include a program / utility 2204 having a set (at least one) of program modules 2205, such program modules 2205 including but not limited to: an operating system, one or more application programs, other program modules and program data, each of which or some combination may include the implementation of a network environment.
[0142] Bus 230 may represent one or more of several types of bus structures, including a memory unit bus or memory unit controller, a peripheral bus, an accelerated graphics port, a processing unit, or a local bus using any of a variety of bus architectures.
[0143] The electronic device 200 may also communicate with one or more external devices 300 (e.g., keyboards, pointing devices, Bluetooth devices, etc.), may also communicate with one or more devices that enable a user to interact with the electronic device 200, and / or communicate with any device that enables the electronic device 200 to communicate with one or more other computing devices (e.g., routers, modems, etc.). Such communication may be performed via an input / output (I / O) interface 250. Furthermore, the electronic device 200 may also communicate with one or more networks (e.g., a local area network (LAN), a wide area network (WAN), and / or a public network, such as the Internet) via a network adapter 260. The network adapter 260 may communicate with other modules of the electronic device 200 via the bus 230. It should be understood that, although not shown in the figure, other hardware and / or software modules may be used in conjunction with the electronic device 200, including but not limited to: microcode, device drivers, redundant processing units, external disk drive arrays, RAID systems, tape drives, and data backup storage systems.
[0144] Through the description of the above implementation, it is easy for those skilled in the art to understand that the example implementation described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the implementation of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, including several instructions to enable a computing device (which can be a personal computer, a server, or a network device, etc.) to execute the above method according to the implementation of the present disclosure.
[0145] Fig.13A schematic diagram of a computer-readable storage medium in an exemplary embodiment of the present disclosure is schematically shown.
[0146] refer to Fig.13 As shown, a program product 400 for implementing the above method according to an embodiment of the present disclosure is described, which can adopt a portable compact disk read-only memory (CD-ROM) and include program code, and can be run on a terminal device, such as a personal computer. However, the program product of the present disclosure is not limited thereto. In this document, a readable storage medium can be any tangible medium containing or storing a program, which can be used by or in combination with an instruction execution system, an apparatus or a device.
[0147] The program product may use any combination of one or more readable media. The readable medium may be a readable signal medium or a readable storage medium. The readable storage medium may be, for example, but not limited to, an electrical, magnetic, optical, electromagnetic, infrared, or semiconductor system, device or device, or any combination of the above. More specific examples (non-exhaustive list) of readable storage media include: an electrical connection with one or more wires, a portable disk, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a portable compact disk read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the above.
[0148] The computer readable storage medium may include a data signal propagated in a baseband or as part of a carrier wave, wherein a readable program code is carried. This propagated data signal may take a variety of forms, including but not limited to an electromagnetic signal, an optical signal, or any suitable combination of the above. The readable storage medium may also be any readable medium other than a readable storage medium, which may send, propagate, or transmit a program for use by an instruction execution system, an apparatus, or a device or used in combination with it. The program code contained on the readable storage medium may be transmitted with any appropriate medium, including but not limited to wireless, wired, optical cable, RF, etc., or any suitable combination of the above.
[0149] Program code for performing the operations of the present disclosure may be written in any combination of one or more programming languages, including object-oriented programming languages such as Java, C++, etc., and conventional procedural programming languages such as "C" or similar programming languages. The program code may be executed entirely on the user computing device, partially on the user device, as a separate software package, partially on the user computing device and partially on a remote computing device, or entirely on a remote computing device or server. In cases involving a remote computing device, the remote computing device may be connected to the user computing device through any type of network, including a local area network (LAN) or a wide area network (WAN), or may be connected to an external computing device (e.g., through the Internet using an Internet service provider).
[0150] The above-mentioned computer-readable medium carries one or more programs. When the above-mentioned one or more programs are executed by a device, the computer-readable medium implements the following functions: receiving at least one request information of a target object; sorting the at least one request information according to the number of visits; obtaining the heat level information of each request information in the at least one request information according to the sorting result; and storing the data information corresponding to each request information in the cache module corresponding to the target object according to the heat level information of each request information.
[0151] Those skilled in the art will appreciate that the above modules can be distributed in the device according to the description of the embodiment, or can be changed accordingly and only used in one or more devices different from the embodiment. The modules of the above embodiments can be combined into one module, or further divided into multiple sub-modules.
[0152] Through the description of the above embodiments, it is easy for those skilled in the art to understand that the example embodiments described here can be implemented by software, or by software combined with necessary hardware. Therefore, the technical solution according to the embodiment of the present disclosure can be embodied in the form of a software product, which can be stored in a non-volatile storage medium (which can be a CD-ROM, a USB flash drive, a mobile hard disk, etc.) or on a network, and includes several instructions to enable a computing device (which can be a personal computer, a server, a mobile terminal, or a network device, etc.) to execute the method according to the embodiment of the present disclosure.
[0153] The exemplary embodiments of the present disclosure are specifically shown and described above. It should be understood that the present disclosure is not limited to the detailed structures, configurations or implementations described herein; on the contrary, the present disclosure is intended to cover various modifications and equivalent configurations included in the spirit and scope of the appended claims.
Claims
1. A data caching method, characterized in that: include: Receiving at least one request information of a target object; sorting the at least one request information according to the number of visits; Obtaining, according to the sorting result, the heat level information of each request information in the at least one request information; According to the heat level information of each request information, the data information corresponding to each request information is stored in the cache module corresponding to the target object, and the cache module corresponding to the target object includes a local cache module and an external cache module, wherein the heat level of the request information corresponding to the data information stored in the local cache module is not lower than the heat level of the request information corresponding to the data information stored in the external cache module.
2. The method according to claim 1, characterized in that Obtaining the heat level information of each request information in the at least one request information according to the sorting result includes: Determine the first popularity information and popularity growth rate of each request information according to the sorting result; Predict each request information according to the first popularity information and the popularity growth rate of each request information to obtain second popularity information of each request information; The heat level information of each request information is determined according to the second heat information of each request information.
3. The method according to claim 2, characterized in that Determining the heat level information of each request information according to the second heat information of each request information includes: Determine the heat level information of the request information whose second heat information is greater than the first threshold as a first heat level; The heat level information of the request information whose second heat level information is less than or equal to the first threshold is determined as a second heat level.
4. The method according to claim 1, characterized in that Storing data information corresponding to each request information in a cache module corresponding to the target object according to the heat level information of each request information includes: Determine the data key value information corresponding to each request information according to the request and data mapping table; Read the data key information corresponding to each request information in the database to obtain the data information corresponding to each request information; Determine the heat level information of each request information as the heat level information of the data information corresponding to each request information; Determine the cache validity period of the data information corresponding to each request information according to the heat level information of the data information corresponding to each request information; The data information corresponding to each request information is stored in a cache module corresponding to the target object according to a cache validity period of the data information corresponding to each request information.
5. The method according to claim 4, characterized in that Determining the cache validity period of the data information corresponding to each request information according to the heat level information of the data information corresponding to each request information includes: Determine that the cache validity period of the data information whose heat level information is the first heat level is the first validity period; Determine that the cache validity period of data information with heat level information of the second heat level is a second effective duration, the second effective duration is less than the first effective duration, and the access volume of data information of the first heat level is greater than the access volume of data information of the second heat level.
6. The method according to claim 4, characterized in that Storing the data information corresponding to each request information in a cache module corresponding to the target object according to the cache validity period of the data information corresponding to each request information includes: The data information with the heat level information of the first heat level is stored in the local cache module and the external cache module corresponding to the target object according to the cache validity period; The data information with the heat level information being the second heat level is stored in the external cache module corresponding to the target object according to its cache validity period.
7. The method according to claim 1, characterized in that Also includes: Receiving target request information of the target object; Reading target data information from the local cache module or the external cache module corresponding to the target object according to the target request information, and updating the cache validity period of the target data information; If the reading fails, the target data information is read from the database according to the target request information, and the target data information is cached in the local cache module and the external cache module corresponding to the target object.
8. A data cache device, characterized in that: include: A request receiving module, configured to receive at least one request information of a target object; A request sorting module, configured to sort the at least one request information according to the number of visits; A heat level module, configured to obtain heat level information of each request information in the at least one request information according to the sorting result; A data cache module is configured to store the data information corresponding to each request information in the cache module corresponding to the target object according to the heat level information of each request information, and the cache module corresponding to the target object includes a local cache module and a distributed cache module, wherein the heat level of the request information corresponding to the data information stored in the local cache module is not lower than the heat level of the request information corresponding to the data information stored in the distributed cache module.
9. An electronic device, characterized in that: include: one or more processors; a storage device for storing one or more programs, When the one or more programs are executed by the one or more processors, the one or more processors implement the method according to any one of claims 1 to 7.
10. A computer readable medium having a computer program stored thereon, characterized in that: When the program is executed by a processor, the method according to any one of claims 1 to 7 is implemented.
Citation Information
Patent Citations
Method and device for caching contents of videos by edge node server
CN103312776A