Processing method and device of cache data, computer storage medium and electronic equipment

文档序号:1477143 发布日期:2020-02-25 浏览:25次 中文

阅读说明:本技术 缓存数据的处理方法及装置、计算机存储介质、电子设备 (Processing method and device of cache data, computer storage medium and electronic equipment ) 是由 谭焰文 冯亮 武磊 李森 于 2019-11-07 设计创作,主要内容包括:本公开涉及数据处理技术领域,提供了一种缓存数据的处理方法、缓存数据的处理装置、计算机存储介质、电子设备,其中,缓存数据的处理方法包括:当待缓存数据与已缓存数据的数据量之和大于缓存容量时,获取已缓存数据对应的初始缓存时间以及访问频次信息;根据当前时间、访问频次信息以及初始缓存时间,确定已缓存数据对应的访问热度;对访问热度小于第一预设阈值的第一缓存数据进行淘汰处理。本公开中的缓存数据的处理方法能够确定出随时间动态变化的访问热度,将已缓存数据的访问热度与其初始缓存时间联系起来,使得访问热度的计算更加贴合实际情况,提高相关处理方法的灵活性以及自适应性。(The disclosure relates to the technical field of data processing, and provides a processing method of cache data, a processing device of cache data, a computer storage medium and an electronic device, wherein the processing method of cache data comprises the following steps: when the sum of the data amount of the data to be cached and the cached data is larger than the caching capacity, acquiring initial caching time and access frequency information corresponding to the cached data; determining the access heat corresponding to the cached data according to the current time, the access frequency information and the initial caching time; and performing elimination processing on the first cache data with the access heat degree smaller than a first preset threshold value. According to the processing method for the cache data, the access heat degree which changes dynamically along with time can be determined, and the access heat degree of the cached data is related to the initial cache time, so that the calculation of the access heat degree is more suitable for the actual situation, and the flexibility and the adaptability of the related processing method are improved.)

1. A processing method for caching data is characterized by comprising the following steps:

when the sum of the data amount of the data to be cached and the cached data is larger than the caching capacity, acquiring initial caching time and access frequency information corresponding to the cached data;

determining the access heat corresponding to the cached data according to the current time, the access frequency information and the initial caching time;

and performing elimination processing on the first cache data with the access heat degree smaller than a first preset threshold value.

2. The method of claim 1, wherein the determining the access heat corresponding to the cached data according to the current time, the access frequency information, and the initial caching time comprises:

determining the access heat corresponding to the cached data based on the following formula:

freq=count*e-(α*(now_time-cache_time))

wherein freq is the access heat, and count is the access frequency information; e is a natural logarithm; alpha is an attenuation coefficient; the now _ time is the current time; and the cache _ time is the initial cache time.

3. The method of claim 2, wherein after performing eviction processing on the first cached data with the access heat less than the first preset threshold, the method further comprises:

acquiring residual data in the cache;

if the sum of the data amount of the data to be cached and the data amount of the residual data is larger than the cache capacity, performing elimination processing on second cache data with the access heat degree smaller than a second preset threshold;

wherein the second preset threshold is greater than the first preset threshold.

4. The method according to claim 1 or 2, characterized in that the method further comprises:

when a user access request is received, obtaining access keywords contained in the user access request;

if the access keyword is judged to be the cached data, acquiring the initial caching time corresponding to the access keyword;

if the time interval between the time of receiving the user access request and the initial caching time is greater than an effective time threshold, judging that the access keyword is overdue;

and storing the access key into expired data.

5. The method of claim 4, further comprising:

if the access key words are not cached data, setting the access frequency information corresponding to the access key words;

storing the access key word and the access frequency information into a first key value pair in a key value pair mode;

and writing the access frequency information in the first key value pair through a first thread.

6. The method of claim 5, further comprising:

storing the access key words and the access frequency information into a second key value pair in a backup mode in a key value pair mode;

and reading the access frequency information in the second key value pair through a second thread.

7. The method of claim 6, wherein after writing the access frequency information in the first key value pair by the first thread, the method further comprises:

and switching the first key-value pair and the second key-value pair.

8. A processing apparatus for caching data, comprising:

the device comprises an acquisition module, a cache module and a processing module, wherein the acquisition module is used for acquiring initial cache time and access frequency information corresponding to cached data when the sum of the data amount of data to be cached and the cached data is larger than the cache capacity;

the index determining module is used for determining the access heat corresponding to the cached data according to the current time, the access frequency information and the initial caching time;

and the elimination processing module is used for eliminating the first cache data with the access heat degree smaller than a first preset threshold value.

9. A computer storage medium having a computer program stored thereon, wherein the computer program, when executed by a processor, implements the method for processing cached data as recited in any one of claims 1 to 7.

10. An electronic device, comprising:

a processor; and

a memory for storing executable instructions of the processor;

wherein the processor is configured to execute the processing method of the cache data according to any one of claims 1 to 7 via executing the executable instruction.

17页详细技术资料下载
上一篇:一种医用注射器针头装配设备
下一篇:存储器控制器

网友询问留言

已有0条留言

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

精彩留言,会给你点赞!

技术分类