Cache data management method, device, equipment and storage medium

文档序号:781742 发布日期:2021-04-09 浏览:28次 中文

阅读说明:本技术 缓存数据管理方法、装置、设备及存储介质 (Cache data management method, device, equipment and storage medium ) 是由 黄凯 张泽武 于 2020-12-25 设计创作,主要内容包括:本申请涉及数据处理领域,尤其涉及一种缓存数据管理方法、装置、设备及存储介质。方法包括:接收目标数据的缓存请求指令后,获取所述缓存请求指令的接收时刻对应的、与所述目标数据访问热度相关的至少一个关联数据的值;根据所述至少一个关联参数的值,获得所述目标数据的访问热度系数;根据所述访问热度系数,获得所述目标数据的缓存过期时间,其中,所述缓存过期时间与所述访问热度系数正相关;为保存至缓存的所述目标数据配置所述缓存过期时间。本申请用以解决缓存命中率低和缓存利用率低的问题。(The present application relates to the field of data processing, and in particular, to a method, an apparatus, a device, and a storage medium for managing cache data. The method comprises the following steps: after a cache request instruction of target data is received, acquiring a value of at least one associated data corresponding to the receiving time of the cache request instruction and related to the access heat of the target data; obtaining an access heat coefficient of the target data according to the value of the at least one correlation parameter; obtaining cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient; and configuring the cache expiration time for the target data saved to the cache. The method and the device are used for solving the problems of low cache hit rate and low cache utilization rate.)

1. A cache data management method, comprising:

after a cache request instruction of target data is received, acquiring a value of at least one associated data corresponding to the receiving time of the cache request instruction and related to the access heat of the target data;

obtaining an access heat coefficient of the target data according to the value of the at least one correlation parameter;

obtaining cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient;

and configuring the cache expiration time for the target data saved to the cache.

2. The cache data management method according to claim 1, wherein the association parameter includes at least one of a positive association parameter and a negative association parameter;

the value of the positive correlation parameter is in positive correlation with the cache expiration time;

the value of the negative correlation parameter is in negative correlation with the cache expiration time.

3. The method according to claim 1, wherein the obtaining an access heat coefficient of the target data according to the value of the at least one correlation parameter comprises:

acquiring a preset weight value corresponding to each association parameter;

and adjusting the intervention degree of the value of each associated parameter to the access heat coefficient through the preset weight value so as to obtain the access heat coefficient of the target data.

4. The method for managing cache data according to claim 1, wherein the obtaining the cache expiration time of the target data according to the access heat coefficient comprises:

acquiring preset reference time;

and obtaining the cache expiration time of the target data according to the preset reference time and the access heat coefficient.

5. The method according to claim 4, wherein the obtaining the preset reference time comprises:

obtaining the remaining storage space of the cache corresponding to the receiving moment;

and acquiring the preset reference time according to the residual storage space.

6. The method for managing cache data according to claim 1, wherein after configuring the cache expiration time for the target data saved to the cache, the method further comprises:

deleting the target data in the cache after the cache expiration time is exceeded.

7. The cache data management method according to claim 6, further comprising, after deleting the target data in the cache after the cache expiration time has elapsed, the step of:

after the cache request instruction of the target data is received again, the value of at least one piece of associated data which corresponds to the receiving moment of the cache request instruction received again and is related to the access heat of the target data is obtained again;

according to the obtained value of the at least one associated data, obtaining the access heat coefficient of the target data again;

according to the obtained access heat coefficient, obtaining a cache expiration time of the target data again, wherein the cache expiration time is positively correlated with the access heat coefficient;

configuring the retrieved cache expiration time for the target data newly saved to the cache.

8. The cache data management method according to claim 1, wherein the association parameter includes at least one of an access user amount, an evaluation parameter, an online time parameter, an access duration, and an access frequency.

9. A cache data management apparatus, comprising:

the acquisition module is used for acquiring at least one value of associated data which corresponds to the receiving moment of the cache request instruction and is related to the access heat of the target data after receiving the cache request instruction of the target data;

the first processing module is used for obtaining an access heat coefficient of the target data according to the value of the at least one correlation parameter;

the second processing module is used for obtaining cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient;

and the configuration module is used for configuring the cache expiration time for the target data stored in the cache.

10. An electronic device, comprising: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus;

the memory for storing a computer program;

the processor is configured to execute the program stored in the memory, and implement the cache data management method according to any one of claims 1 to 8.

11. A computer-readable storage medium storing a computer program, wherein the computer program, when executed by a processor, implements the cache data management method according to any one of claims 1 to 8.

Technical Field

The present application relates to the field of data processing, and in particular, to a method, an apparatus, a device, and a storage medium for managing cache data.

Background

For internet applications, whether on the server side or the client side, the use of caching technology is widespread. The cached application can accelerate the request response, and the cache on the end can reduce the overhead caused by repeated requests and provide good use experience for users. In the existing caching technology, a fixed expiration time is usually configured for data in a cache, and when the expiration time is met, the data will be invalid, and when the data is requested next time, the data is restored to the cache and the fixed expiration time is set again.

In the face of a scene that hundreds of millions of large data are set at the level of millions, the cache is a precious storage resource. Whether the cache is reasonably used is an urgent problem to be solved. However, in the current caching technology, the same fixed expiration time is set for different cached data, which reduces the utilization rate of the cache and the cache hit rate. For example, the first set of data and the second set of data are simultaneously stored in the cache and the expiration times are the same. The first set of data is requested 300 times before the expiration time is reached and the second set of data is requested only 1 time before the expiration time is reached. After both sets of data are cleared from the cache by the expiration time, it is clear that the first set of data is more likely to be requested again, but the first set of data cannot be hit in the cache when requested again, thereby reducing the cache hit rate. And after the second group of data is requested for 1 time, the second group of data is not requested again until the expiration time is reached, but still occupies the space of the cache, and the utilization rate of the cache is reduced.

Disclosure of Invention

The application provides a cache data management method, a cache data management device and a cache data management storage medium, which are used for solving the problems of low cache hit rate and low cache utilization rate.

In a first aspect, an embodiment of the present application provides a cache data management method, including: after a cache request instruction of target data is received, acquiring a value of at least one associated data corresponding to the receiving time of the cache request instruction and related to the access heat of the target data; obtaining an access heat coefficient of the target data according to the value of the at least one correlation parameter; obtaining cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient; and configuring the cache expiration time for the target data saved to the cache.

Optionally, the association parameters include at least one of positive association parameters and negative association parameters; the value of the positive correlation parameter is in positive correlation with the cache expiration time; the value of the negative correlation parameter is in negative correlation with the cache expiration time.

Optionally, the obtaining, according to the value of the at least one correlation parameter, an access heat coefficient of the target data includes: acquiring a preset weight value corresponding to each association parameter; and adjusting the intervention degree of the value of each associated parameter to the access heat coefficient through the preset weight value so as to obtain the access heat coefficient of the target data.

Optionally, the obtaining the cache expiration time of the target data according to the access heat coefficient includes: acquiring preset reference time; and obtaining the cache expiration time of the target data according to the preset reference time and the access heat coefficient.

Optionally, the acquiring the preset reference time includes: obtaining the remaining storage space of the cache corresponding to the receiving moment; and acquiring the preset reference time according to the residual storage space.

Optionally, after configuring the cache expiration time for the target data saved to the cache, the method further includes: deleting the target data in the cache after the cache expiration time is exceeded.

Optionally, after the target data in the cache is deleted after the cache expiration time is exceeded, the method further includes: after the cache request instruction of the target data is received again, the value of at least one piece of associated data which corresponds to the receiving moment of the cache request instruction received again and is related to the access heat of the target data is obtained again; according to the obtained value of the at least one associated data, obtaining the access heat coefficient of the target data again; according to the obtained access heat coefficient, obtaining a cache expiration time of the target data again, wherein the cache expiration time is positively correlated with the access heat coefficient; configuring the retrieved cache expiration time for the target data newly saved to the cache.

Optionally, the associated parameter includes at least one of an access user amount, an evaluation parameter, an online time parameter, an access duration, and an access frequency.

In a second aspect, an embodiment of the present application provides a cache data management apparatus, including: the acquisition module is used for acquiring at least one value of associated data which corresponds to the receiving moment of the cache request instruction and is related to the access heat of the target data after receiving the cache request instruction of the target data; the first processing module is used for obtaining an access heat coefficient of the target data according to the value of the at least one correlation parameter; the second processing module is used for obtaining cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient; and the configuration module is used for configuring the cache expiration time for the target data stored in the cache.

In a third aspect, an embodiment of the present application provides an electronic device, including: the system comprises a processor, a communication interface, a memory and a communication bus, wherein the processor, the communication interface and the memory are communicated with each other through the communication bus; the memory for storing a computer program; the processor is configured to execute the program stored in the memory, and implement the cache data management method according to the first aspect.

In a fourth aspect, an embodiment of the present application provides a computer-readable storage medium, which stores a computer program, and when the computer program is executed by a processor, the computer program implements the cache data management method according to the first aspect.

Compared with the prior art, the technical scheme provided by the embodiment of the application has the following advantages: according to the method provided by the embodiment of the application, the corresponding cache expiration time is configured for the target data according to the access heat of the target data, the access heat is represented by an access heat coefficient, the access heat coefficient is obtained by processing the associated parameters related to the access heat, and the cache expiration time is longer as the access heat coefficient is larger. When different data are stored in the cache, different cache expiration times are set according to the access heat of target data, the data with higher access heat are accessed, the cache expiration time is longer, and the time existing in the cache is longer; and the data with low access heat is accessed, the cache expiration time is short, and the time existing in the cache is short. Therefore, the cache hit rate can be improved, the problem that certain data cannot be requested for a long time after being stored in the cache but still occupy cache space is solved, the cache space is saved, and the cache utilization rate is improved.

Drawings

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

In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below, and it is obvious for those skilled in the art that other drawings can be obtained according to the drawings without inventive exercise.

Fig. 1 is a schematic flowchart illustrating steps of a cache data management method provided in an embodiment of the present application;

fig. 2 is a schematic flowchart of a process for obtaining target data according to a cache request instruction in an embodiment of the present application;

fig. 3 is a schematic flowchart illustrating a procedure of configuring a new cache expiration time after the cache expiration time of the target data provided in the embodiment of the present application expires;

fig. 4 is a schematic structural diagram of a cache data management apparatus provided in an embodiment of the present application;

fig. 5 is a schematic structural diagram of an electronic device provided in an embodiment of the present application.

Detailed Description

In order to make the objects, technical solutions and advantages of the embodiments of the present application clearer, the technical solutions in the embodiments of the present application will be clearly and completely described below with reference to the drawings in the embodiments of the present application, and it is obvious that the described embodiments are some embodiments of the present application, but not all embodiments. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present application.

The embodiment of the application provides a cache data management method, which is applied to a server side applying a cache technology and a client side applying the cache technology. In the following embodiments of the method, a server side applying a caching technology is taken as an example for description.

In one embodiment, as shown in fig. 1, the cache data management method mainly includes the following steps:

step 101, after receiving a cache request instruction of target data, obtaining a value of at least one associated data corresponding to a receiving time of the cache request instruction and related to the access heat of the target data.

In one embodiment, as shown in fig. 2, before obtaining the value of at least one associated data related to the target data access heat corresponding to the receiving time of the cache request instruction, the following process is included:

step 201, obtaining a cache request instruction for target data transmitted by a terminal;

step 202, according to the cache request instruction, determining whether target data exists in the cache, if so, executing step 203, otherwise, executing step 204;

step 203, returning the target data in the cache to the terminal;

and step 204, acquiring target data from the data center.

In this embodiment, after the target data is acquired from the data center, the target data is stored in the cache, and the target data is returned to the terminal. The process of storing the target data into the cache and returning the target data to the terminal can be carried out after the target data is obtained from the data center, and the process of obtaining the associated parameters has no fixed time relation before and after. The target data can be stored in a cache before the associated parameters are obtained and returned to the terminal, and then the associated parameters are obtained; or storing the target data to a cache and returning the target data to the terminal after acquiring the associated parameters; or acquiring the associated parameters while the target data is stored in the cache and returned to the terminal. The protection range of the application is not limited by the fact that target data are stored in the cache and returned to the terminal, and the time before and after the associated parameters are obtained is limited.

In one embodiment, the value of the at least one associated datum refers to a value corresponding to a time of receiving the cache request instruction. According to the specific type and actual need of the associated parameter, the time corresponding to the time when the cache request instruction is obtained can be a statistical value of the time when the cache request instruction is obtained, and can also be a current value of the time when the cache request instruction is obtained.

In one embodiment, the associated parameter includes at least one of an access user amount, an evaluation parameter, an online time parameter, an access duration and an access frequency, and other types of parameters may also be used as the associated parameter according to specific situations and actual needs.

In this embodiment, the number of access users may be a statistical accumulated value up to the time of obtaining the cache request instruction, or may be an online number of access users at the time of obtaining the cache request instruction. The evaluation parameter is a parameter related to evaluation of the target data, for example, the number of praise, score, and the like. The on-line time parameter may be a time when the target data is on-line, or may be an on-line time from the time when the target data is on-line to a time when the cache request instruction is obtained. The access duration is the average duration of the target data accessed by the user when the cache request instruction is obtained. The access frequency is the frequency of accessing the target data by the user until the cache request instruction is obtained. Other types of associated parameters may define specific content as desired.

In this embodiment, the specific type of the associated parameter is set according to the actual situation and the needs, so that the determination of the cache expiration time is more flexible to meet the needs of various types of data, and the determined cache expiration time is more reasonable, which is beneficial to further improving the cache utilization rate.

In one embodiment, the association parameters include at least one of positive association parameters and negative association parameters. The value of the positive correlation parameter is in positive correlation with the cache expiration time, that is, the larger the value of the positive correlation parameter is, the longer the cache expiration time is obtained. The value of the negative correlation parameter is in a negative correlation relationship with the cache expiration time, i.e., the larger the value of the negative correlation parameter is, the shorter the obtained cache expiration time is.

In this embodiment, the positive association parameter may be a plurality of parameters, such as the above access user amount, the evaluation parameter, the access time length, the access frequency, and the like. The larger the number of the accessing users is, the higher the evaluation parameter is, the longer the accessing time is, or the higher the accessing frequency is, which indicates that the target data is more popular to the public, and the hit rate after being stored in the cache may be larger. Thus, these parameters are positive correlation parameters.

The negative correlation parameter page may be a variety of parameters, such as the above up time parameter. The longer the online time is, the less fresh the target data is, and the less interest the public has in the target data, and accordingly, the hit rate after being saved in the cache may be smaller. Thus, such parameters are negative correlation parameters.

In this embodiment, the requirement of the public on the target data can be more comprehensively reflected by the associated parameters which are in positive and negative correlation with the cache expiration time, so that the cache expiration time is more reasonable, and the waste of the cache space is further avoided.

And 102, acquiring an access heat coefficient of the target data according to the value of at least one associated parameter.

In one embodiment, when the access heat coefficient of the access heat of the target data is obtained, the intervention degree of different associated parameters on the access heat coefficient is adjusted through a preset weight value. The specific process is as follows: acquiring a preset weight value corresponding to each associated parameter; and adjusting the intervention degree of the access heat coefficient of each value of the associated parameter through the preset weight value so as to obtain the access heat coefficient of the target data.

In this embodiment, the preset weight value corresponding to the positive association parameter is a positive number, and the larger the preset weight value corresponding to the positive association parameter is, the larger the access heat coefficient is. The preset weight value corresponding to the negative correlation parameter is a negative number, and the larger the preset weight value corresponding to the negative correlation parameter is, the smaller the access heat coefficient is.

In this embodiment, different association parameters have different influences on the cache expiration time, for example, the longer the online time parameter is compared with the evaluation parameter, the greater the demand of the public on the target data is, and even if the evaluation parameter is relatively larger, the cache expiration time is smaller because the online time is longer. In order to realize the influence degree of different association parameters on the cache expiration time, the intervention degree of the different association parameters on the hot access coefficient is adjusted through presetting the weight values. Because the hot access coefficient is in direct proportion to the cache expiration time, the influence of different associated parameters on the cache expiration time is adjusted.

In one embodiment, when the number of the associated parameters related to the access heat is greater than 1, the intervention degree of the access heat coefficient is adjusted by the value of each associated parameter through a preset weight value, and the specific process is as follows: respectively carrying out the following processing on each association parameter in the at least one association parameter: and acquiring a preset reference value and a preset weight value which are correspondingly configured to the associated parameter, multiplying the ratio of the associated parameter to the preset reference value by the preset weight value, and taking the obtained result as an access heat contribution value corresponding to the associated parameter. And accumulating the heat contribution values corresponding to each associated parameter in the at least one associated parameter, and obtaining the access heat coefficient of the target data according to the accumulated result.

In this embodiment, after the heat contribution values corresponding to each associated parameter are accumulated, a heat accumulated value is obtained; accumulating preset weight values configured correspondingly to the associated parameters to obtain a weight accumulated value; and taking the ratio of the heat accumulated value and the weight accumulated value as a heat access coefficient.

In one embodiment, when the number of the associated parameters related to the access heat is equal to 1, the intervention degree of the access heat coefficient is adjusted by the value of each associated parameter through a preset weight value, and the specific process is as follows: and acquiring a preset reference value configured corresponding to the associated parameter, and taking the ratio of the associated parameter to the preset reference value as an access heat coefficient of the target data.

In this embodiment, the influence of each associated parameter on the cache expiration time is adjusted through the preset reference value and the preset weight value configured corresponding to the associated parameter, so that the cache expiration time more conforming to the hot state of the target data is obtained, and the cache hit rate is improved while the data in the cache is cleared in time.

And 103, obtaining the cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient.

The positive correlation between the cache expiration time and the access heat coefficient specifically means that the higher the access heat coefficient is, the longer the cache expiration time is; conversely, the lower the access heat coefficient, the shorter the cache expiration time.

In one embodiment, obtaining the cache expiration time of the target data according to the access heat coefficient includes: acquiring preset reference time; and obtaining the cache expiration time of the target data according to the preset reference time and the access heat coefficient. Specifically, the preset reference time is firstly obtained, and then the preset reference time is multiplied by the access heat coefficient to obtain the cache expiration time of the target data.

In this embodiment, since the access heat coefficient is an objective value obtained by calculating the correlation parameter, when there is some requirement, for example, when the storage space is smaller and smaller, the cache expiration time of the data in the cache cannot be adjusted as a whole to release more storage space. And through presetting the benchmark time, this type of problem of solution that can be convenient increases the flexibility for setting up of buffer memory expiration time, further improves the buffer memory utilization ratio.

In one embodiment, the specific process of acquiring the preset reference time is as follows: obtaining the cached residual storage space corresponding to the receiving time; and acquiring preset reference time according to the residual storage space.

In this embodiment, a reference time set is preset, and a plurality of preset reference times are stored in the set. Dividing the storage space of the cache into a plurality of intervals according to the size of the space allowance, wherein each interval corresponds to a preset reference time. And when the residual storage space of the cache belongs to a certain interval, acquiring corresponding preset reference time. For example, the total storage space of the buffer is 30 million, and is divided into a first interval and a second interval according to the size of the space margin, wherein the first interval is 0 to 15 million and includes 15 million, and the second interval is 15 to 30 million and includes 30 million. The preset reference time corresponding to the first interval is 3 days, and the preset reference time corresponding to the second interval is 5 days. When the remaining storage space of the buffer corresponding to the receiving time is 12 megabits, the preset reference time is acquired as 3 days because 12 megabits belong to the first interval.

In this embodiment, the preset reference time is obtained through the remaining storage space of the cache, and the setting of the cache expiration time can be related to the remaining storage space of the cache itself. When the remaining storage space of the cache is smaller and smaller, the cache expiration time of the target data can be automatically shortened, the release of more cache resources is accelerated, and the cache utilization rate is further improved.

And 104, configuring cache expiration time for the target data stored in the cache.

In one embodiment, after the cache expiration time is configured for the target data saved to the cache, the target data in the cache is deleted after the cache expiration time is exceeded.

In this embodiment, after the cache expiration time is configured for the target data stored in the cache, the target data will have the cache expiration time in the cache, and after the cache expiration time is exceeded, the target data in the cache is deleted. The process of deleting the target data in the cache can be realized in a Remote Dictionary service (Redis) mode, and the target data in the cache is automatically cleared.

In an embodiment, as shown in fig. 3, after the cache expiration time is exceeded, the target data in the cache is deleted, and if a request is made for the target data again, the cache expiration time is recalculated, which includes the following specific processes:

step 301, after receiving the cache request instruction of the target data again, re-obtaining the value of at least one associated data related to the access heat of the target data corresponding to the receiving time of receiving the cache request instruction again;

step 302, according to the value of at least one piece of associated data obtained again, obtaining the access heat coefficient of the target data again;

step 303, obtaining the cache expiration time of the target data again according to the obtained access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient;

and step 304, configuring the retrieved cache expiration time for the target data which is newly saved to the cache.

In this embodiment, for the same target data, the access heat of the target data may change at different time stages. When the cache expiration time of the target data is expired, if a cache request instruction for the target data is received again, new cache expiration time is configured for the target data again, and the target data after the cache expiration time is configured is stored in the cache. The process can ensure that different cache expiration times are given to the target data according to the access heat at different time stages. For example, when a certain video resource is online for one month, a longer cache expiration time is set for the video resource; when the video resource is online for one year, a shorter cache expiration time is set for the video resource. The process further ensures that the cache expiration time is close to the actual situation, and improves the cache hit rate and the cache utilization rate.

In one embodiment, the target data is video data, and the associated parameters include an access user amount, an evaluation parameter and an online time parameter. Wherein the number of visiting users is the number of online visiting people and is represented by H; the evaluation parameters comprise the number of praise and the score, the number of praise is represented by L, and the score is represented by S; the online time parameter is online time, specifically, the online time is the online time of the video data, and the online time is represented by D until the time of obtaining the cache request instruction. The access user quantity H, the praise number L and the score S belong to positive correlation parameters, and the online time D is a negative correlation parameter.

Correspondingly, the preset reference values comprise an online visit number upper limit, a praise number upper limit, a grading upper limit and a duration reference value, wherein the visit number upper limit is represented by Hm, the praise number upper limit is represented by Lm, the grading upper limit is represented by Sm, and the duration reference value is taken as 100 days.

In this embodiment, the specific principle of the value of the duration reference value is as follows: the heat of the video data is gradually reduced along with the time, one quarter is determined as a node after statistics and calculation based on a large amount of data, the time length of one quarter is expanded to 100 days, and when the online time length exceeds 100 days, the influence of the online time length on the cache expiration time is the maximum, so that the time length reference value is taken as 100 days.

In this embodiment, when the number of days obtained until the time of obtaining the cache request instruction is less than or equal to 100, the obtained real number of days is used as the online time length D; and when the number of acquired days until the cache request instruction acquisition time is more than 100, taking 100 days as an online time length D. Therefore, the influence of the online time on the cache expiration time can be reflected more truly.

In this embodiment, the preset weight values configured corresponding to the associated parameters include an online access number weight value, a like number weight value, a scoring weight value, and a duration weight value, where the online access number weight value is represented by x, the like number weight value is represented by y, the scoring weight value is represented by z, and the duration weight value is represented by k. The online access people number weight value x, the praise number weight value y and the grading weight value z are positive numbers, and the duration weight value k is a negative number. The preset weight value is set according to actual conditions and needs, and the protection range of the application is not limited by a specific determination mode of the preset weight value.

In this embodiment, the process of video data management is as follows:

and acquiring a cache request instruction for the video data transmitted by the terminal. And according to the cache request instruction, after determining that the video data does not exist in the cache, acquiring the video data from the data center, storing the video data to the cache after acquiring the video data from the data center, and returning the video data to the terminal.

And acquiring the value of the associated parameter related to the video data access heat and corresponding to the moment of acquiring the cache request instruction, wherein the associated parameter comprises the number of online access people H, the number of praise L, the score S and the online time D. And acquiring preset reference values which are correspondingly configured by the associated parameters, wherein the preset reference values comprise an upper limit Hm of the number of visitors, an upper limit Lm of praise number, an upper limit Sm of score and a duration reference value 100. And acquiring preset weight values correspondingly configured by the associated parameters, wherein the preset weight values comprise an online access number weight value x, a praise number weight value y, a grading weight value z and a duration weight value k.

The specific calculation relationship for obtaining the access heat coefficient is as follows:

and acquiring a preset reference time, wherein the preset reference time is represented by Tm. Multiplying the preset reference time by the access heat coefficient to obtain the cache expiration time of the video data, wherein the specific calculation formula is as follows:

cache expiration time Tm hot access coefficient

And configuring expiration cache time for the video data stored to the cache, and deleting the video data in the cache after the expiration cache time is exceeded.

The cache data management method provided in the embodiment of the present application is introduced by being applied to a server side applying a cache technology, and corresponding processing procedures are all completed at the server side. When the cache data management method is applied to a client side applying a cache technology, required data is acquired from a data center and is completed through an interface of a server side, corresponding processing processes of the method are all completed at the client side, other processes are the same as those at the server side, and details are not repeated here.

According to the cache data management method, corresponding cache expiration time is configured for the target data according to the access heat of the target data, the access heat is represented by an access heat coefficient obtained after processing associated parameters related to the access heat, and the higher the access heat is, the larger the access heat coefficient is, the longer the cache expiration time is. Different cache expiration times are set in the cache of different data according to the access heat, the data with higher access heat is accessed, the cache expiration time is longer, and the time existing in the cache is longer; and the data with low access heat is accessed, the cache expiration time is short, and the time existing in the cache is short. The cache hit rate can be improved, and meanwhile, the problem that certain data cannot be requested for a long time after being stored in the cache but still occupy cache space is avoided, so that the cache space is saved, and the utilization rate of the cache is improved.

For example, the cache expiration time corresponding to the first group of data with higher access frequency is set to 15 days, and the cache expiration time corresponding to the second group of data with lower access frequency is set to 3 days. Because the access heat of the second group of data is low, the requested possibility is low, and the second group of data in the cache is automatically deleted after the second group of data is temporarily stored in the cache for 3 days, the phenomenon that the second group of data exists in the cache for a long time but can not be requested is avoided, the cache utilization rate is improved, and the cache storage space is saved. The first group of data has high access heat, is more likely to be requested, has longer storage time in the cache, can be hit in the cache when being requested, and further improves the cache hit rate.

Based on the same concept, embodiments of the present application provide a cache data management apparatus, and specific implementation of the apparatus may refer to the description of the method embodiment, and repeated details are not repeated, as shown in fig. 4, the apparatus mainly includes:

an obtaining module 401, configured to obtain, after receiving a cache request instruction of target data, a value of at least one piece of associated data corresponding to a receiving time of the cache request instruction and related to access heat of the target data;

a first processing module 402, configured to obtain an access heat coefficient of the target data according to a value of at least one associated parameter;

the second processing module 403 is configured to obtain a cache expiration time of the target data according to the access heat coefficient, where the cache expiration time is positively correlated to the access heat coefficient;

a configuration module 404, configured to configure a cache expiration time for the target data saved to the cache.

Based on the same concept, an embodiment of the present application further provides an electronic device, as shown in fig. 5, the electronic device mainly includes: a processor 501, a communication interface 502, a memory 503 and a communication bus 504, wherein the processor 501, the communication interface 502 and the memory 503 are communicated with each other through the communication bus 504. Wherein, the memory 503 stores the program that can be executed by the processor 501, and the processor 501 executes the program stored in the memory 503, implementing the following steps: after a cache request instruction of target data is received, acquiring a value of at least one associated data corresponding to the receiving time of the cache request instruction and related to the access heat of the target data; obtaining an access heat coefficient of the target data according to the value of at least one correlation parameter; obtaining cache expiration time of the target data according to the access heat coefficient, wherein the cache expiration time is positively correlated with the access heat coefficient; and configuring the cache expiration time for the target data stored in the cache.

The communication bus 504 mentioned in the above electronic device may be a Peripheral Component Interconnect (PCI) bus, an Extended Industry Standard Architecture (EISA) bus, or the like. The communication bus 504 may be divided into an address bus, a data bus, a control bus, etc. For ease of illustration, only one thick line is shown in FIG. 5, but this is not intended to represent only one bus or type of bus.

The communication interface 502 is used for communication between the above-described electronic apparatus and other apparatuses.

The Memory 503 may include a Random Access Memory (RAM) or a non-volatile Memory (non-volatile Memory), such as at least one disk Memory. Alternatively, the memory may be at least one memory device located remotely from the aforementioned processor 501.

The Processor 501 may be a general-purpose Processor, including a Central Processing Unit (CPU), a Network Processor (NP), etc., and may also be a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), a Field Programmable Gate Array (FPGA) or other Programmable logic devices, discrete gates or transistor logic devices, and discrete hardware components.

In yet another embodiment of the present application, there is also provided a computer-readable storage medium having stored therein a computer program, which, when run on a computer, causes the computer to execute the cache data management method described in the above embodiment.

In the above embodiments, the implementation may be wholly or partially realized by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product. The computer program product includes one or more computer instructions. When loaded and executed on a computer, cause the processes or functions described in accordance with the embodiments of the application to occur, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a network of computers, or other programmable device. The computer instructions may be stored on a computer readable storage medium or transmitted from one computer readable storage medium to another, for example, from one website site, computer, server, or data center to another website site, computer, server, or data center via wire (e.g., coaxial cable, fiber optic, Digital Subscriber Line (DSL)) or wirelessly (e.g., infrared, microwave, etc.). The computer-readable storage medium can be any available medium that can be accessed by a computer or a data storage device, such as a server, a data center, etc., that includes one or more of the available media. The available media may be magnetic media (e.g., floppy disks, hard disks, tapes, etc.), optical media (e.g., DVDs), or semiconductor media (e.g., solid state drives), among others.

It is noted that, in this document, relational terms such as "first" and "second," and the like, may be used solely to distinguish one entity or action from another entity or action without necessarily requiring or implying any actual such relationship or order between such entities or actions. Also, the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, method, article, or apparatus that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, method, article, or apparatus. Without further limitation, an element defined by the phrase "comprising an … …" does not exclude the presence of other identical elements in a process, method, article, or apparatus that comprises the element.

The foregoing are merely exemplary embodiments of the present invention, which enable those skilled in the art to understand or practice the present invention. Various modifications to these embodiments will be readily apparent to those skilled in the art, and the generic principles defined herein may be applied to other embodiments without departing from the spirit or scope of the invention. Thus, the present invention is not intended to be limited to the embodiments shown herein but is to be accorded the widest scope consistent with the principles and novel features disclosed herein.

16页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:外接操作设备的识别方法、设备及存储介质

网友询问留言

已有0条留言

还没有人留言评论。精彩留言会获得点赞!

精彩留言,会给你点赞!

技术分类