CN111078585A - Memory cache management method, system, storage medium and electronic equipment - Google Patents

Memory cache management method, system, storage medium and electronic equipment Download PDF

Info

Publication number
CN111078585A
CN111078585A CN201911203587.5A CN201911203587A CN111078585A CN 111078585 A CN111078585 A CN 111078585A CN 201911203587 A CN201911203587 A CN 201911203587A CN 111078585 A CN111078585 A CN 111078585A
Authority
CN
China
Prior art keywords
cache
life cycle
value set
data
characteristic value
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Granted
Application number
CN201911203587.5A
Other languages
Chinese (zh)
Other versions
CN111078585B (en
Inventor
王海波
何涛
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Cognitive Computing Nanjing Information Technology Co ltd
Original Assignee
Cognitive Computing Nanjing Information Technology Co ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Cognitive Computing Nanjing Information Technology Co ltd filed Critical Cognitive Computing Nanjing Information Technology Co ltd
Priority to CN201911203587.5A priority Critical patent/CN111078585B/en
Publication of CN111078585A publication Critical patent/CN111078585A/en
Application granted granted Critical
Publication of CN111078585B publication Critical patent/CN111078585B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/0223User address space allocation, e.g. contiguous or non contiguous base addressing
    • G06F12/023Free address space management
    • G06F12/0253Garbage collection, i.e. reclamation of unreferenced memory

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The invention provides a memory cache management method, a system, a storage medium and an electronic device, wherein the method comprises the following steps: when a data analysis request is received, analyzing to obtain a data characteristic value set and a behavior characteristic value set; inquiring the cache record; if the cache record does not exist and the requested data needs to be cached, querying historical cache time; when the historical cache time exists, acquiring a historical cache life cycle; calculating the time interval between the current access time and the latest access time; if the historical cache life cycles are less than or equal to the time interval, taking the time interval as a new cache life cycle; and if at least one historical cache life cycle is larger than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval. The invention adopts a dynamic optimization memory cache management method, thereby optimizing the resource allocation strategy, reducing the recovery and allocation frequency of resources, improving the system response time and optimizing the user experience.

Description

Memory cache management method, system, storage medium and electronic equipment
Technical Field
The present invention relates to the field of computer data processing technologies, and in particular, to a memory cache management method, system, storage medium, and electronic device.
Background
Memory caching is a common solution for increasing the response speed of computer software, and the management mechanism of memory caching is generally fixed. However, under the condition of limited resources, when a plurality of users operate large data volume, the memory cache resources are not enough to be used, and the system can continuously recycle and redistribute the memory resources, so that the system response is slow, and the user experience is poor.
Because each user has different frequency and time for processing the same batch of data, the unified memory caching scheme treats data and use conditions without distinction, unified memory management is carried out, and resources are greatly wasted.
Disclosure of Invention
The invention aims to provide a memory cache management method, a memory cache management system, a storage medium and electronic equipment, which realize the adoption of a dynamically optimized memory cache management method, thereby optimizing a resource allocation strategy, reducing the recovery and allocation frequency of resources, improving the system response time and optimizing the user experience.
The technical scheme provided by the invention is as follows:
the invention provides a memory cache management method, which comprises the following steps:
when a data analysis request is received, analyzing the request data to obtain a data characteristic value set and a behavior characteristic value set;
inquiring cache records according to the data characteristic value set;
if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain that the request data needs to be cached, querying historical cache time according to the data characteristic value set and the behavior characteristic value set;
when the historical cache time exists, acquiring a historical cache life cycle;
calculating the time interval between the access time of this time in the behavior characteristic value set and the recorded latest access time;
if the historical cache life cycles are less than or equal to the time interval, taking the time interval as a new cache life cycle;
and if at least one historical cache life cycle is larger than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval.
Further, analyzing the request data to obtain a data feature value set specifically includes:
according to the request dataGenerates a set of data eigenvalues Λ, Λ ═ λ1,λ2,…λi…,λnIn which λ isiThe characteristic value of the ith metadata is n, and the n is the number of the metadata;
analyzing the data feature value set to obtain that the request data needs to be cached specifically includes:
obtaining cache weights corresponding to the metadata;
calculating a buffer level L according to the data characteristic value set and the buffer weightcache
Figure BDA0002296454750000021
When any one of λ is 0, the buffer level Lcache0, the request data is not cached;
when cache level LcacheWhen not 0, the request data is cached.
Further, if the historical cache life cycle is greater than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval, and then:
and setting a timer according to the new cache life cycle, and recording the latest access time and the behavior characteristic value set.
Further, if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain that the request data needs to be cached, querying historical cache time according to the data characteristic value set and the behavior characteristic value set further includes:
if the historical caching time does not exist, caching the request data in the memory, and setting an initial caching life cycle as a preset cycle;
and setting a timer according to the initial cache life cycle, and recording the latest access time and the behavior characteristic value set.
Further, the method also comprises the following steps:
and when the cache life cycle recorded by the timer reaches, releasing the cached request data, and setting a historical cache life cycle according to the cache life cycle.
The present invention also provides a memory cache management system, including:
the analysis module is used for analyzing the request data to obtain a data characteristic value set and a behavior characteristic value set when receiving a data analysis request;
the query module queries cache records according to the data characteristic value set obtained by the analysis module;
the query module is used for querying historical cache time according to the data characteristic value set and the behavior characteristic value set obtained by the analysis module if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain that the request data needs to be cached;
the computing module is used for acquiring a historical cache life cycle and computing the time interval between the current access time in the behavior characteristic value set and the recorded latest access time when the historical cache time is acquired by the query module;
the processing module is used for taking the time interval as a new cache life cycle if the historical cache life cycles obtained by the calculating module are less than or equal to the time interval;
the processing module is used for calculating a new cache life cycle according to the historical cache life cycle and the time interval if the historical cache life cycle obtained by at least one calculating module is larger than the time interval;
the processing module caches the request data in the memory if the historical caching time does not exist, and sets an initial caching life cycle as a preset cycle;
and the setting module is used for setting a timer according to a cache life cycle, and recording the latest access time and the behavior characteristic value set, wherein the cache life cycle comprises the new cache life cycle and the initial cache life cycle.
Further, the analysis module generates a data characteristic value set Lambda according to the characteristic value of the metadata of the request data,Λ={λ1,λ2,…λi…,λnin which λ isiThe characteristic value of the ith metadata is n, and the n is the number of the metadata;
the query module acquires the cache weight corresponding to each metadata; calculating a buffer level L according to the data characteristic value set and the buffer weightcache
Figure BDA0002296454750000041
When any one of λ is 0, the buffer level Lcache0, the request data is not cached; when cache level LcacheWhen not 0, the request data is cached.
Further, the method also comprises the following steps:
and the setting module releases the cached request data when the cache life cycle recorded by the timer is reached, and sets a historical cache life cycle according to the cache life cycle.
The invention also provides a storage medium having stored thereon a computer program which, when executed by a processor, implements any of the methods described above.
The invention also provides an electronic device comprising a memory and a processor, wherein the memory stores a computer program running on the processor, and the processor implements any one of the methods described above when executing the computer program.
By adopting the memory cache management method, the memory cache management system, the storage medium and the electronic equipment, which are provided by the invention, a dynamic optimization memory cache management method is adopted, so that a resource allocation strategy is optimized, the recovery and allocation frequency of resources is reduced, the system response time is improved, and the user experience is optimized.
Drawings
The above features, technical features, advantages and implementations of a memory cache management method, system, storage medium and electronic device will be further described in the following detailed description of preferred embodiments in conjunction with the accompanying drawings.
FIG. 1 is a flow chart of one embodiment of a memory cache management method of the present invention;
FIG. 2 is a flow chart of another embodiment of a memory cache management method of the present invention;
fig. 3 is a schematic structural diagram of an embodiment of memory cache management according to the present invention.
Detailed Description
In order to more clearly illustrate the embodiments of the present invention or the technical solutions in the prior art, the following description will explain specific embodiments of the present invention with reference to the drawings of the specification. It is obvious that the drawings in the following description are only some examples of the invention, from which other drawings and embodiments can be derived by a person skilled in the art without inventive effort.
For the sake of simplicity, only the parts relevant to the present invention are schematically shown in the drawings, and they do not represent the actual structure as a product. In addition, in order to make the drawings concise and understandable, components having the same structure or function in some of the drawings are only schematically illustrated or only labeled. In this document, "one" means not only "only one" but also a case of "more than one".
An embodiment of the present invention, as shown in fig. 1, is a memory cache management method, including:
s100, when a data analysis request is received, analyzing request data to obtain a data characteristic value set and a behavior characteristic value set;
s200, inquiring cache records according to the data characteristic value set;
s300, if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain that the request data needs to be cached, querying historical cache time according to the data characteristic value set and the behavior characteristic value set;
s400, when historical cache time exists, obtaining a historical cache life cycle, and calculating the time interval between the current access time and the recorded latest access time in the behavior characteristic value set;
s500, if the historical cache life cycles are less than or equal to the time interval, taking the time interval as a new cache life cycle;
s600, if at least one historical cache life cycle is larger than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval.
Specifically, in this embodiment, when a data analysis request sent by a user is received, the request data and the related user behavior data are analyzed to obtain a data characteristic value set and a behavior characteristic value set. Each metadata in the set of data feature values is described by a number of feature values, including but not limited to: the characteristic value may be an enumerated value, for example, the data type is video, audio, or text, the enumerated value corresponds to a preset label, and the characteristic value may also be a continuous value, for example, the data range. Thus, a set of data characteristic values Λ, Λ ═ λ is generated from the characteristic values of the metadata of the requested data1,λ2,…λi…,λnIn which λ isiIs the characteristic value of the ith metadata, and n is the number of the metadata.
And inquiring the cache record of the cached data in the memory according to the hash value of the data characteristic value set, namely judging whether the data requested by the current user is cached in the memory. If the request data does not exist in the cache record, the request data is not cached in the memory, and therefore the corresponding cache level is calculated according to the data characteristic value set, and whether the request data needs to be cached or not is judged.
Generating a set of data eigenvalues Λ, Λ ═ λ from eigenvalues of metadata of the requested data1,λ2,…λi…,λnAnd acquiring cache weights corresponding to the metadata, wherein each characteristic value corresponds to a weight, the value is between 0 and 100 and represents the influence of the characteristic value on the cache level, and the higher the weight is, the higher the cache requirement is. According to the data characteristic value set and the corresponding buffer weight meterCompute cache level Lcache
Figure BDA0002296454750000061
When any one of λ is 0, the buffer level Lcache0, request data not cached, when cache level LcacheWhen not 0, the requested data needs to be buffered. And judging whether the user needs to cache the request data or not by analyzing the related data of the data analysis request sent by the user, and if not, setting the characteristic value of one metadata to be 0.
If the requested data needs to be cached, querying historical caching time according to the data characteristic value set and the behavior characteristic value set, wherein the behavior characteristic value set specifically consists of corresponding behavior characteristic values, and the method comprises the following steps of: user name, data, request type, requested service, requested time of day, etc., the data in the behavior feature value set is described by a Hash value of the data feature value set. The historical caching time is queried according to the data characteristic value set and the behavior characteristic value set, that is, whether the same requested data is cached based on the same behavior characteristic value set is queried, for example, whether the same user requests the same type of service for the same data.
If the historical cache time exists, the recorded historical cache life cycle corresponding to the data characteristic value set and the behavior characteristic value set is obtained, and meanwhile, the time interval between the access time (the time of the request in the behavior characteristic value set) recorded in the current behavior characteristic value set and the latest access time recorded in the Hash dictionary is calculated.
If the historical caching life cycles are less than or equal to the time interval, the caching life cycle of the requested data is increased based on the behavior habits of the user. Therefore, the calculated time interval is directly taken as the new buffer life cycle.
If the historical cache life cycle is greater than the time interval, a new cache life cycle may be calculated from the historical cache life cycle and the time interval based on a preset weight ratio. For example, if there is only one history buffer life cycle, the average of the history buffer life cycle and the time interval may be used as the new buffer life cycle. If there are a plurality of historical cache life cycles and all the historical cache life cycles are larger than the time interval, the average value can be taken as a new cache life cycle, and a corresponding weight ratio can be set based on the time length of the historical cache life cycle so as to calculate the new cache life cycle. If there are a plurality of history buffer life cycles, wherein a part of the history buffer life cycles is greater than the time interval, and a part of the history buffer life cycles is less than or equal to the time interval, the average value can be taken as a new buffer life cycle, a corresponding weight ratio can be set based on the time length of the history buffer life cycle, or after the history buffer life cycles less than or equal to the time interval are removed, the new buffer life cycle is calculated based on the remaining history buffer life cycles.
In addition, if the request data exists in the cache record, the request data is cached in the memory, so that the corresponding cache level is calculated according to the data characteristic value set, and whether the request data needs to be cached is judged. If the data needs to be cached, a new caching life cycle is calculated according to the data characteristic value set and the behavior characteristic value set.
And inquiring historical cache time according to the data characteristic value set and the behavior characteristic value set, acquiring a historical cache life cycle, and calculating the time interval between the access time in the behavior characteristic value set and the recorded latest access time. If the historical cache life cycle does not exist, the request data cached in the memory is the first time cached with records and is not released, the timer is directly cleared, and the time interval is used as a new cache life cycle. And setting a new cache life cycle according to the method for different comparison results of the historical cache life cycle and the time interval.
After the invention continuously learns and updates the cache use time, the data caches corresponding to different data and different user habits can obtain a more reasonable life cycle management, thereby fully utilizing the memory resources of the computer and optimizing the user experience.
Preferably, in another embodiment of the present invention, if the historical cache life cycle is greater than the time interval, after calculating a new cache life cycle according to the historical cache life cycle and the time interval, the step S600 further includes: s700, setting a timer according to the new cache life cycle, and recording the latest access time and the behavior characteristic value set.
Specifically, since the request data is not cached in the memory at present, after the request data is cached in the memory this time, a timer is set according to a new cache life cycle obtained by calculation, and the cached request data is deleted after the cache time arrives. And meanwhile, updating the access time as the latest access time in the Hash dictionary, and recording the behavior characteristic value set.
In addition, after the buffer life cycle in the timer reaches the time or the buffer life cycle in the timer is updated due to the user requesting the same data again, the period recorded in the timer is taken as the history buffer life cycle. The historical cache life cycle can only reserve the latest cache life cycle, or reserve the longest or shortest cache life cycle, or reserve the preset number of cache life cycles completely, and can be set according to respective rules of users.
Another embodiment of the present invention is an optimization embodiment of the foregoing embodiment, as shown in fig. 2, the main improvement of this embodiment is that, if the request data does not exist in the cache record and the data feature value set is analyzed to obtain that the request data needs to be cached, after querying the historical cache time according to the data feature value set and the behavior feature value set, the method further includes:
s800, if the historical caching time does not exist, caching the request data in a memory, and setting an initial caching life cycle as a preset cycle;
s850, setting a timer according to the initial cache life cycle, and recording the latest access time and the behavior characteristic value set;
s900, when the initial cache life cycle recorded by the timer is reached, releasing the cached request data, and setting a historical cache life cycle according to the initial cache life cycle.
Specifically, in this embodiment, when a data analysis request sent by a user is received, the request data and the related user behavior data are analyzed to obtain a data characteristic value set and a behavior characteristic value set, and a cache record of data cached in the memory is queried according to a hash value of the data characteristic value set, that is, it is determined whether data requested by the current user is cached in the memory. If the request data does not exist in the cache record, the request data is not cached in the memory, and therefore the corresponding cache level is calculated according to the data characteristic value set, and whether the request data needs to be cached or not is judged.
If the requested data needs to be cached, querying the historical caching time according to the data characteristic value set and the behavior characteristic value set, that is, querying whether the same requested data is cached based on the same behavior characteristic value set, for example, whether the same user requests the same type of service for the same data.
If the historical caching time does not exist, the request data is not cached based on the same behavior characteristic value set, so that the request data is cached in the memory, an initial caching life cycle is set as a preset cycle, and the preset cycle can be the time set by a user or the time set by the user based on the statistical analysis of the caching cycle of the data of a specific type.
And setting a timer according to the set initial cache life cycle, and deleting the cached request data after the cache time is up. And meanwhile, updating the access time as the latest access time in the Hash dictionary, and recording the behavior characteristic value set. If the user does not request the request data again until the initial cache life cycle time arrives, that is, the cached request data is automatically deleted after the initial cache life cycle time arrives, the initial cache life cycle time cannot reflect the behavior characteristics of the user, so the initial cache life cycle time is not directly used as the history cache, but the history cache life cycle is set according to the initial cache life cycle, for example, half of the initial cache life cycle is set as the history cache life cycle, and the specific relationship between the history cache life cycle and the initial cache life cycle can be set differently based on the user requirements.
Meanwhile, the system maintains a monitoring thread, once the cache region is full, the cache data is released according to the arrangement of the cache levels from low to high, and the cache data is released according to the rule which is not used for the longest time in a unified level.
According to the method and the device, for the request data which is not recorded and cached, the user behavior which is not recorded during the first caching is referred, and then the preset period is uniformly set as the initial caching life cycle to manage the cached data. After the release, for the initial cache life cycle which can not reflect the behavior habit of the user, corresponding processing is carried out to be used as the historical cache life cycle, so that the behavior characteristics of the user can be more approximate.
In an embodiment of the present invention, as shown in fig. 3, a memory cache management system 100 includes:
the analysis module 110 is configured to, when receiving a data analysis request, analyze request data to obtain a data characteristic value set and a behavior characteristic value set;
the analysis module 110 generates a data feature value set Λ, Λ ═ λ from feature values of metadata of the request data1,λ2,…λi…,λnIn which λ isiThe characteristic value of the ith metadata is n, and the n is the number of the metadata;
the query module 120 queries the cache record according to the data feature value set obtained by the analysis module 110;
if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain the request data needing to be cached, the query module 120 queries historical cache time according to the data characteristic value set and the behavior characteristic value set obtained by the analysis module 110;
the query module 120 obtains the cache weight corresponding to each metadata; from the set of data feature values andthe cache weight calculates the cache level Lcache
Figure BDA0002296454750000111
When any one of λ is 0, the buffer level Lcache0, the request data is not cached; when cache level LcacheWhen the value is not 0, the request data is cached;
a calculating module 130, configured to, when the historical cache time is obtained by the querying module 120, obtain a historical cache life cycle, and calculate a time interval between the current access time in the behavior feature value set and the recorded latest access time;
the processing module 140, if the historical cache life cycles obtained by the calculating module 130 are all less than or equal to the time interval, taking the time interval as a new cache life cycle;
the processing module 140, if the historical cache life cycle obtained by at least one of the calculating modules 130 is greater than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval;
the processing module 140, if the historical caching time does not exist, the query module 120 caches the request data in the memory, and sets an initial caching life cycle as a preset cycle;
the setting module 150 is used for setting a timer according to a cache life cycle, and recording the latest access time and the behavior characteristic value set, wherein the cache life cycle comprises the new cache life cycle and the initial cache life cycle;
the setting module 150 releases the cached request data when the initial cache life cycle recorded by the timer arrives, and sets a historical cache life cycle according to the initial cache life cycle.
The specific operation modes of the modules in this embodiment have been described in detail in the corresponding method embodiments, and thus are not described in detail again.
An embodiment of the invention provides a computer-readable storage medium, on which a computer program is stored which, when being executed by a processor, carries out all or part of the method steps of the first embodiment.
All or part of the flow of the method according to the embodiments of the present invention may be implemented by a computer program, which may be stored in a computer-readable storage medium and used by a processor to implement the steps of the embodiments of the method. Wherein the computer program comprises computer program code, which may be in the form of source code, object code, an executable file or some intermediate form, etc. The computer-readable medium may include: any entity or device capable of carrying the computer program code, recording medium, usb disk, removable hard disk, magnetic disk, optical disk, computer Memory, Read-only Memory (ROM), Random Access Memory (RAM), electrical carrier wave signals, telecommunications signals, software distribution medium, etc. It should be noted that the computer readable medium may contain content that is subject to appropriate increase or decrease as required by legislation and patent practice in jurisdictions, for example, in some jurisdictions, computer readable media does not include electrical carrier signals and telecommunications signals as is required by legislation and patent practice.
An embodiment of the present invention further provides an electronic device, which includes a memory and a processor, wherein the memory stores a computer program running on the processor, and the processor executes the computer program to implement all or part of the method steps in the first embodiment.
The Processor may be a Central Processing Unit (CPU), other general purpose Processor, a Digital Signal Processor (DSP), an Application Specific Integrated Circuit (ASIC), an off-the-shelf Programmable Gate Array (FPGA) or other Programmable logic device, discrete Gate or transistor logic, discrete hardware components, etc. The general purpose processor may be a microprocessor or the processor may be any conventional processor or the like which is the control center for the computer device and which connects the various parts of the overall computer device using various interfaces and lines.
The memory may be used to store the computer programs and/or modules, and the processor may implement various functions of the computer device by running or executing the computer programs and/or modules stored in the memory and invoking data stored in the memory. The memory may mainly include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required by at least one function (such as a sound playing function, an image playing function, etc.), and the like; the storage data area may store data (such as audio data, video data, etc.) created according to the use of the cellular phone, etc. In addition, the memory may include high speed random access memory, and may also include non-volatile memory, such as a hard disk, a memory, a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash memory Card (Flash Card), at least one magnetic disk storage device, a Flash memory device, or other volatile solid state storage device.
It should be noted that the above embodiments can be freely combined as necessary. The foregoing is only a preferred embodiment of the present invention, and it should be noted that, for those skilled in the art, various modifications and decorations can be made without departing from the principle of the present invention, and these modifications and decorations should also be regarded as the protection scope of the present invention.

Claims (10)

1. A memory cache management method is characterized by comprising the following steps:
when a data analysis request is received, analyzing the request data to obtain a data characteristic value set and a behavior characteristic value set;
inquiring cache records according to the data characteristic value set;
if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain that the request data needs to be cached, querying historical cache time according to the data characteristic value set and the behavior characteristic value set;
when the historical cache time exists, acquiring a historical cache life cycle;
calculating the time interval between the access time of this time in the behavior characteristic value set and the recorded latest access time;
if the historical cache life cycles are less than or equal to the time interval, taking the time interval as a new cache life cycle;
and if at least one historical cache life cycle is larger than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval.
2. The memory cache management method according to claim 1, wherein analyzing the request data to obtain the data feature value set specifically comprises:
generating a set of data eigenvalues Λ, Λ ═ λ { λ from eigenvalues of metadata of the request data1,λ2,…λi…,λnIn which λ isiThe characteristic value of the ith metadata is n, and the n is the number of the metadata;
analyzing the data feature value set to obtain that the request data needs to be cached specifically includes:
obtaining cache weights corresponding to the metadata;
calculating a buffer level L according to the data characteristic value set and the buffer weightcache
Figure FDA0002296454740000011
When any one of λ is 0, the buffer level Lcache0, the request data is not cached;
when cache level LcacheWhen not 0, the request data is cached.
3. The memory cache management method according to claim 1, wherein if the historical cache life cycle is greater than the time interval, calculating a new cache life cycle according to the historical cache life cycle and the time interval further comprises:
and setting a timer according to the new cache life cycle, and recording the latest access time and the behavior characteristic value set.
4. The memory cache management method according to claim 1, wherein if the request data does not exist in the cache record and the request data needs to be cached by analyzing the data feature value set, after querying a historical cache time according to the data feature value set and the behavior feature value set, the method further comprises:
if the historical caching time does not exist, caching the request data in the memory, and setting an initial caching life cycle as a preset cycle;
and setting a timer according to the initial cache life cycle, and recording the latest access time and the behavior characteristic value set.
5. The memory cache management method according to claim 4, further comprising:
and releasing the cached request data when the initial cache life cycle recorded by the timer is reached, and setting a historical cache life cycle according to the initial cache life cycle.
6. A memory cache management system, comprising:
the analysis module is used for analyzing the request data to obtain a data characteristic value set and a behavior characteristic value set when receiving a data analysis request;
the query module queries cache records according to the data characteristic value set obtained by the analysis module;
the query module is used for querying historical cache time according to the data characteristic value set and the behavior characteristic value set obtained by the analysis module if the request data does not exist in the cache record and the data characteristic value set is analyzed to obtain that the request data needs to be cached;
the computing module is used for acquiring a historical cache life cycle and computing the time interval between the current access time in the behavior characteristic value set and the recorded latest access time when the historical cache time is acquired by the query module;
the processing module is used for taking the time interval as a new cache life cycle if the historical cache life cycles obtained by the calculating module are less than or equal to the time interval;
the processing module is used for calculating a new cache life cycle according to the historical cache life cycle and the time interval if the historical cache life cycle obtained by at least one calculating module is larger than the time interval;
the processing module caches the request data in the memory if the historical caching time does not exist, and sets an initial caching life cycle as a preset cycle;
and the setting module is used for setting a timer according to a cache life cycle, and recording the latest access time and the behavior characteristic value set, wherein the cache life cycle comprises the new cache life cycle and the initial cache life cycle.
7. The memory cache management system of claim 6, wherein:
the analysis module generates a data characteristic value set Lambda according to the characteristic value of the metadata of the request data, and the Lambda is { Lambda }1,λ2,…λi…,λnIn which λ isiThe characteristic value of the ith metadata is n, and the n is the number of the metadata;
the query module acquires the cache weight corresponding to each metadata; calculating a buffer level L according to the data characteristic value set and the buffer weightcache
Figure FDA0002296454740000031
When any one of λ is 0, the buffer level Lcache0, the request data is not cached; when cache level LcacheWhen not 0, the request data is cached.
8. The memory cache management system of claim 6, further comprising:
and the setting module releases the cached request data when the initial cache life cycle recorded by the timer is reached, and sets a historical cache life cycle according to the initial cache life cycle.
9. A storage medium having a computer program stored thereon, characterized in that: the computer program, when executed by a processor, implements the method of any of claims 1 to 5.
10. An electronic device comprising a memory and a processor, the memory having stored thereon a computer program that runs on the processor, characterized in that: the processor, when executing the computer program, implements the method of any of claims 1 to 5.
CN201911203587.5A 2019-11-29 2019-11-29 Memory cache management method, system, storage medium and electronic equipment Active CN111078585B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201911203587.5A CN111078585B (en) 2019-11-29 2019-11-29 Memory cache management method, system, storage medium and electronic equipment

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201911203587.5A CN111078585B (en) 2019-11-29 2019-11-29 Memory cache management method, system, storage medium and electronic equipment

Publications (2)

Publication Number Publication Date
CN111078585A true CN111078585A (en) 2020-04-28
CN111078585B CN111078585B (en) 2022-03-29

Family

ID=70312138

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201911203587.5A Active CN111078585B (en) 2019-11-29 2019-11-29 Memory cache management method, system, storage medium and electronic equipment

Country Status (1)

Country Link
CN (1) CN111078585B (en)

Cited By (3)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN113485971A (en) * 2021-06-18 2021-10-08 翱捷科技股份有限公司 Cache setting and using method and device of file system
CN113691859A (en) * 2021-09-16 2021-11-23 百果园技术(新加坡)有限公司 Video caching method, device, equipment and medium
WO2021232769A1 (en) * 2020-05-18 2021-11-25 北京市商汤科技开发有限公司 Method for storing data and data processing apparatus

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6851038B1 (en) * 2000-05-26 2005-02-01 Koninklijke Philips Electronics N.V. Background fetching of translation lookaside buffer (TLB) entries
CN101576856A (en) * 2009-06-18 2009-11-11 浪潮电子信息产业股份有限公司 Buffer data replacement method based on access frequency within long and short cycle
US8423715B2 (en) * 2008-05-01 2013-04-16 International Business Machines Corporation Memory management among levels of cache in a memory hierarchy
CN106528444A (en) * 2016-12-05 2017-03-22 北京金和网络股份有限公司 Automatic management method of object cached in memory
CN106649139A (en) * 2016-12-29 2017-05-10 北京奇虎科技有限公司 Data eliminating method and device based on multiple caches
CN110008190A (en) * 2019-03-21 2019-07-12 武汉理工大学 A kind of periodic small documents caching replacement method

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6851038B1 (en) * 2000-05-26 2005-02-01 Koninklijke Philips Electronics N.V. Background fetching of translation lookaside buffer (TLB) entries
US8423715B2 (en) * 2008-05-01 2013-04-16 International Business Machines Corporation Memory management among levels of cache in a memory hierarchy
CN101576856A (en) * 2009-06-18 2009-11-11 浪潮电子信息产业股份有限公司 Buffer data replacement method based on access frequency within long and short cycle
CN106528444A (en) * 2016-12-05 2017-03-22 北京金和网络股份有限公司 Automatic management method of object cached in memory
CN106649139A (en) * 2016-12-29 2017-05-10 北京奇虎科技有限公司 Data eliminating method and device based on multiple caches
CN110008190A (en) * 2019-03-21 2019-07-12 武汉理工大学 A kind of periodic small documents caching replacement method

Non-Patent Citations (2)

* Cited by examiner, † Cited by third party
Title
HAO CHE 等: "Hierarchical Web Caching Systems: Modeling,Design and Experimental Results", 《IEEE》 *
王永亮: "缓存淘汰算法研究", 《电子技术与软件工程》 *

Cited By (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2021232769A1 (en) * 2020-05-18 2021-11-25 北京市商汤科技开发有限公司 Method for storing data and data processing apparatus
CN113485971A (en) * 2021-06-18 2021-10-08 翱捷科技股份有限公司 Cache setting and using method and device of file system
CN113485971B (en) * 2021-06-18 2023-08-01 翱捷科技股份有限公司 Method and device for using cache setting of file system
CN113691859A (en) * 2021-09-16 2021-11-23 百果园技术(新加坡)有限公司 Video caching method, device, equipment and medium

Also Published As

Publication number Publication date
CN111078585B (en) 2022-03-29

Similar Documents

Publication Publication Date Title
CN111078585B (en) Memory cache management method, system, storage medium and electronic equipment
US11734271B2 (en) Data query method, apparatus and device
US10133679B2 (en) Read cache management method and apparatus based on solid state drive
US11323514B2 (en) Data tiering for edge computers, hubs and central systems
CN108694075B (en) Method and device for processing report data, electronic equipment and readable storage medium
US8904116B2 (en) System and method of selectively caching information based on the interarrival time of requests for the same information
US9015269B2 (en) Methods and systems for notifying a server with cache information and for serving resources based on it
CN109379395B (en) Interface data cache setting method and terminal equipment
US20110167239A1 (en) Methods and apparatuses for usage based allocation block size tuning
CN110990439A (en) Cache-based quick query method and device, computer equipment and storage medium
CN109446225B (en) Data caching method and device, computer equipment and storage medium
CN112131260A (en) Data query method and device
CN114697683A (en) Intelligent scheduling method, equipment and computer program product for streaming media file
CN112631504A (en) Method and device for realizing local cache by using off-heap memory
CN110750498B (en) Object access method, device and storage medium
US11005776B2 (en) Resource allocation using restore credits
CN117130792A (en) Processing method, device, equipment and storage medium for cache object
JP2004118482A (en) Storage device and cache method
CN117056033A (en) Data processing method, device, MEC server and storage medium
CN114020766A (en) Data query method and device and terminal equipment
CN107196962B (en) User access control method and system
CN112187667A (en) Data downloading method, device, equipment and storage medium
WO2021135988A1 (en) Hotspot code processing method, request method, apparatus, and electronic device
CN116149550B (en) Data management method, device, storage medium and equipment
CN110134509B (en) Data caching method and device

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant