CN112363986B - Time optimization method for file caching - Google Patents

Time optimization method for file caching Download PDF

Info

Publication number
CN112363986B
CN112363986B CN202110051596.8A CN202110051596A CN112363986B CN 112363986 B CN112363986 B CN 112363986B CN 202110051596 A CN202110051596 A CN 202110051596A CN 112363986 B CN112363986 B CN 112363986B
Authority
CN
China
Prior art keywords
cache
file
time
threshold
determining
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.)
Active
Application number
CN202110051596.8A
Other languages
Chinese (zh)
Other versions
CN112363986A (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.)
Beijing Dongfangtong Software Co ltd
Beijing Tongtech Co Ltd
Original Assignee
Beijing Dongfangtong Software Co ltd
Beijing Tongtech 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 Beijing Dongfangtong Software Co ltd, Beijing Tongtech Co Ltd filed Critical Beijing Dongfangtong Software Co ltd
Priority to CN202110051596.8A priority Critical patent/CN112363986B/en
Publication of CN112363986A publication Critical patent/CN112363986A/en
Application granted granted Critical
Publication of CN112363986B publication Critical patent/CN112363986B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/172Caching, prefetching or hoarding of files
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/1734Details of monitoring file system events, e.g. by the use of hooks, filter drivers, logs
    • GPHYSICS
    • G06COMPUTING; CALCULATING; COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/10File systems; File servers
    • G06F16/17Details of further file system functions
    • G06F16/174Redundancy elimination performed by the file system

Abstract

The invention provides a time optimization method for file caching. The method comprises the following steps: obtaining a cache file, accessing key information of the cache file at regular time, and determining target key information; constructing a cache time optimization rule according to the target key information and preset constraint conditions; screening the cache files according to the time optimization rule to determine screened files; and importing the screening file into a preset cache pool, and caching the screening file. The invention has the beneficial effects that: by constructing the time optimization rule of the cached files, the efficiency of file caching is improved.

Description

Time optimization method for file caching
Technical Field
The invention relates to the technical field of file caching, in particular to a time optimization method for file caching.
Background
At present, internet information faces an information era of explosion of mass data, an internet system needs to process mass data, meanwhile, in a computer system, storage devices with minimum storage capacity and fastest response are stored in a computer, and the current file cache either eliminates a file entry with the longest access time or eliminates an entry which is least frequently accessed recently, so that the invention provides a method for simplifying and optimizing the file cache, and the method is used for solving the problem that the file cache occupies too long time; the invention has the beneficial effects that: by constructing a time optimization rule, the files are screened, unnecessary files are eliminated in time, the files are timely filtered by regularly monitoring the files, the occupation of resources due to overlong files is reduced, and the waste of time and resources is avoided.
Disclosure of Invention
The invention provides a time optimization method for file caching, which is used for solving the problem that the file caching occupies too long time.
The time optimization method for the file cache is characterized by comprising the following steps:
obtaining a cache file, accessing key information of the cache file at regular time, and determining target key information;
constructing a cache time optimization rule according to the target key information and preset constraint conditions;
screening the cache files according to the time optimization rule to determine screened files;
and importing the screening file into a preset idle cache pool, and caching the screening file.
As an embodiment of the present invention: the obtaining of the cache file, accessing the key information of the cache file at regular time, and determining the target key information include:
obtaining the cache file and determining a key path of the cache file;
searching key information of the cache file according to the key path;
determining the access times of the cache files according to the key information of the cache files;
accumulating the interval duration of the access times of the cache files according to the access times of the cache files, and determining the average duration;
determining the time interval for accessing the cache file at regular time according to the average time length;
and scanning the target key information of the cache file at regular time according to the time interval, and recording the target key information of the cache file.
As an embodiment of the present invention: the key information also comprises file codes, file sizes, the latest access time of the files and the access frequency of the files; wherein the content of the first and second substances,
the file code is used for uniquely marking the file;
sequencing the file codes and determining a coding sequence;
acquiring an idle memory space, and calculating the caching time of the caching file according to the size of the caching file;
based on the memory space and according to the latest access time of the cache files, time sequencing is carried out on the cache files, and the latest access time line is determined;
the file access times are used for carrying out time sequencing on the cache files and determining the sequence of the maximum access times;
as an embodiment of the present invention: the method for constructing the cache time optimization rule through the target key information and the preset constraint conditions comprises the following steps:
determining the caching priority of the caching files according to the target key information;
determining a elimination threshold value of the cache file according to the key information;
constructing constraint conditions according to the elimination threshold value to generate feasible regions and infeasible regions;
and constructing a time optimization rule based on the elimination threshold and the constraint condition according to the cache priority.
As an embodiment of the present invention: the determining the caching priority order of the cached files according to the target key information includes:
determining a three-dimensional coordinate axis which takes the access time line as a base axis by taking the cache time as an X axis, the latest access time line as a Y axis and the most access frequency sequence as a Z axis;
mapping the cached files on the three-dimensional coordinate axis according to the coding sequence;
calculating the distance from the origin of the three-dimensional coordinate axis to the cache file according to the coordinates of the cache file;
and sequencing the distances and determining the caching priority of the cached files.
As an embodiment of the present invention: according to preset constraint conditions and the elimination threshold, constructing a cache file time optimization rule, which comprises the following steps:
setting a time threshold according to the most recent access timeline;
setting a frequency threshold according to the maximum access frequency sequence;
setting a culling threshold according to the time threshold and the frequency threshold;
and based on a preset constraint condition, taking the time threshold and the frequency threshold as boundary lines, and constructing a cache file time optimization rule according to the cache time of the cache file.
As an embodiment of the present invention: determining the elimination threshold of the cache file according to the key information comprises the following steps:
determining the caching range of the cached file according to the cached file and the latest access time of the key information; wherein the content of the first and second substances,
calculating the number of the cache files according to the memory size of the memory space;
determining the caching range of the cached files according to the number and the file codes;
determining the range of the latest access time and the range of the latest access frequency according to the cache range, and generating a time threshold and a frequency threshold;
and determining the elimination threshold of the cache file according to the time threshold and the frequency threshold.
As an embodiment of the present invention: constructing a constraint condition according to the elimination threshold value to generate a feasible region and an infeasible region, wherein the method comprises the following steps:
generating a two-dimensional coordinate axis which takes the latest access time as a horizontal axis and the access frequency as a vertical axis;
generating a threshold boundary value according to the time threshold value and the frequency threshold value;
mapping the threshold boundary value on the two-dimensional coordinate axis to determine the threshold boundary line;
mapping the threshold boundary line on the two-dimensional coordinate axis to determine a feasible region and an infeasible region,
the step of mapping the threshold boundary line on the two-dimensional coordinate axis to determine a feasible region and an infeasible region comprises the following steps:
step 1: obtaining the boundary threshold value and determining the coordinate of the boundary threshold value lineDetermining a mapping function:
wherein the content of the first and second substances,indicating a boundary threshold lineThe included angle between each coordinate point and the origin;indicating a boundary threshold lineThe abscissa of each coordinate point;indicating a boundary threshold lineThe ordinate of the individual coordinate points;representing spatial coefficients; the above-mentionedIs shown asA normal distribution function of the coordinate points;the total number of coordinates of the boundary threshold line;
step 2: generating a threshold boundary setting model according to the time threshold and the frequency threshold:
wherein the content of the first and second substances,represents a time threshold constant;represents a frequency threshold constant;representing a characteristic value of the feasible region;represents a period;a value of a characteristic of an infeasible area;represents the abscissa middle value;representing the mean value of the abscissa and the mean value of the ordinate;
and step 3: setting a model according to the mapping function and a threshold boundary, and determining a feasible region and an infeasible region;
wherein whenCoordinates of the boundary threshold lineAn infeasible region exists with a region within the origin; when in useCoordinates of the boundary threshold lineThe region within the origin is the feasible region.
As an embodiment of the present invention: and constructing a time optimization rule based on the elimination threshold and the constraint condition according to the cache priority order, wherein the time optimization rule comprises the following steps:
acquiring coordinate points of the cache file according to the three-dimensional coordinate axis of the cache priority order;
determining a time optimization algorithm of the cache file according to the coordinate point, the elimination threshold and the constraint condition and a preset algorithm;
and constructing a time optimization rule according to the time optimization algorithm.
As an embodiment of the present invention: the screening the cache files according to the time optimization rule to determine the screened files comprises:
determining the range of the cache file according to the range of the feasible region;
mapping the latest access time and the access frequency of the cache file to the two-dimensional coordinate axis to generate a mapping result;
if the cache file is in the feasible region, determining a screening file, and queuing the screening file;
and if the cache file is in the infeasible area, releasing the cache file.
As an embodiment of the present invention: the importing the screening file into a preset cache pool, and caching the screening file comprises the following steps:
scanning key information of the screened file regularly through a preset cache pool, updating the latest access time and the access frequency of the screened file in time, and generating a cache result;
releasing the cache file in time according to the cache result to obtain an idle cache pool;
based on the idle cache pool, sequentially reading key codes of key information of the screening files;
and sequentially reading the screening files into the idle cache pool according to the key codes.
The invention has the beneficial effects that: the invention improves the comprehensiveness of data acquisition by constructing the keyword list of the data source. By constructing the acquisition grammar, the invention is based on the abstract grammar tree and determines the acquisition grammar through the customized reflection rule, so the acquisition grammar is flexible and changeable, and the acquisition grammar conforms to the requirement of data acquisition because of the customized reflection rule. The invention constructs the data acquisition rule according to the acquisition grammar, so that the data acquisition can be dynamically acquired. According to the invention, the data acquisition rule is associated with the keyword of the keyword list, so that the rule loophole is better and the acquired data is more accurate in a more comprehensive and dynamic updating mode of data acquisition.
Additional features and advantages of the invention will be set forth in the description which follows, and in part will be obvious from the description, or may be learned by practice of the invention. The objectives and other advantages of the invention will be realized and attained by the structure particularly pointed out in the written description and drawings.
The technical solution of the present invention is further described in detail by the accompanying drawings and embodiments.
Drawings
The accompanying drawings, which are included to provide a further understanding of the invention and are incorporated in and constitute a part of this specification, illustrate embodiments of the invention and together with the description serve to explain the principles of the invention and not to limit the invention. In the drawings:
fig. 1 is a flowchart of a method for acquiring multi-source heterogeneous data according to an embodiment of the present invention.
Detailed Description
The preferred embodiments of the present invention will be described in conjunction with the accompanying drawings, and it will be understood that they are described herein for the purpose of illustration and explanation and not limitation.
In the stage that data storage of the internet gradually transits to cloud storage, the operation speed of a memory is required to be faster and faster, stricter requirements are provided for time resources and memory resources of file caching, access items which are not frequently used or are not used for too long are released through a cache pool by the file caching based on a certain algorithm, the cache pool is released, the operation efficiency of the whole computer system is enabled to be more efficient and convenient, time optimization is carried out on the file caching through a specific algorithm, the file caching is enabled to be more time-saving, and files which are not cleared in time can be scanned by the file memory regularly and released.
Example 1:
as shown in fig. 1, the method for optimizing time of a file cache includes:
obtaining a cache file, accessing key information of the cache file at regular time, and determining target key information;
constructing a cache time optimization rule according to the target key information and preset constraint conditions;
screening the cache files according to the time optimization rule to determine screened files;
and importing the screening file into a preset idle cache pool, and caching the screening file.
The principle of the invention is as follows: by acquiring the target key information of the cache file, recalling the time rule and the access frequency rule of the cache file, and performing a certain algorithm according to the generated rule, a time optimization rule for file cache is constructed based on constraint conditions, and the cache file can become a screening file after passing through the optimization rule, can be cached by a cache pool, and reduces unnecessary file cache.
The invention has the beneficial effects that: the method comprises the steps of accessing target key information of the cache files regularly, updating and saving files timely, constructing a cache time optimization rule according to the key information of the latest time and preset constraint conditions, reducing the time for caching the files, updating resources of a cache pool timely, obtaining an idle cache pool, screening the cache files according to the time optimization rule, determining the screened files, screening the cache files, avoiding unnecessary caching and improving the operating efficiency of a computer system.
Example 2:
as an embodiment of the present invention: the obtaining of the cache file, accessing the key information of the cache file at regular time, and determining the target key information include:
obtaining the cache file and determining a key path of the cache file;
searching key information of the cache file according to the key path;
determining the access times of the cache files according to the key information of the cache files;
accumulating the interval duration of the access times of the cache files according to the access times of the cache files, and determining the average duration;
determining the time interval for accessing the cache file at regular time according to the average time length;
and scanning the key information of the cache file at regular time according to the time interval, and recording the target key information of the cache file.
The principle of the invention is as follows: and determining the access times of the cache files by searching the key path of the cache files, wherein the access times of each cache file are accumulated respectively, and the average value is obtained, so that the average time length of the cache files is calculated, the time interval of the cache files is obtained according to specific calculation, and the time interval is fed back to a timing scanning system of the cache files to determine the timing time length.
The invention has the beneficial effects that: according to the key path of the cache file, the key information of the cache file is searched, the uniqueness of the file is determined, the file is convenient to number, the access times of the file are determined, the interval duration of the access times of the cache file is accumulated, the average duration and the time interval of the timed access of the cache file are determined, the time interval of the timed access is determined, the whole time interval is more suitable for the cache file, the key information of the cache file can be recorded more accurately and accurately in the whole timed scanning process, the error of the key information is reduced in the whole scanning process, and the efficiency is improved.
Example 3:
as an embodiment of the present invention: the target key information also comprises file codes, file sizes, the latest access time of the files and the access frequency of the files; wherein the content of the first and second substances,
the file code is used for uniquely marking the file; wherein the content of the first and second substances,
sequencing the file codes and determining a coding sequence;
acquiring an idle memory space, and calculating the caching time of the cached file according to the size of the file;
based on the memory space, according to the latest access time of the file, time sequencing is carried out on the cache file, and a latest access time line is determined;
the file access times are used for carrying out time sequencing on the cache files and determining the sequence of the maximum access times;
the principle of the invention is as follows: the file coding is a unique mark for distinguishing other files, and the codes are all sorted according to the address size, the coding sequence of the files needs to be recorded, the files are read in according to the coding sequence after a cache pool is obtained, the cache time is calculated, the files are sorted according to the latest access time of the files by using a sorting algorithm, and the latest access time line is determined; sorting the times of the cache files according to the access times of the files, and determining the sequence of the most access times;
the invention has the beneficial effects that: by data statistics and calculation of access time and access frequency of the cache files, the access time sequence is a time line, the access frequency is also listed in sequence, the whole key information is processed for the second time, and the data of the key information is more regular and better used.
Example 4:
as an embodiment of the present invention: the method for constructing the cache time optimization rule through the target key information and the preset constraint conditions comprises the following steps:
determining the caching priority of the caching files according to the target key information;
determining an elimination threshold of the cache file according to the target key information;
constructing constraint conditions according to the elimination threshold value to generate feasible regions and infeasible regions;
and constructing a time optimization rule based on the elimination threshold and the constraint condition according to the cache priority.
The principle of the invention is as follows: determining a cache priority and an elimination threshold according to target key information, constructing a constraint condition, generating a feasible region and an infeasible region, constructing a time optimization rule based on the elimination threshold and the constraint condition, utilizing the constraint condition to limit access time and access frequency of cache files, regarding the cache files as an objective function, screening the files under a certain constraint condition, wherein the access time and the access frequency represent variables for caching the files, and thus, a limit range is applied to the file cache.
The invention has the beneficial effects that: the cache file is divided according to the constraint conditions, the cache file is screened in advance, unnecessary cache is reduced, the efficiency of the cache file is improved, accurate calculation is carried out on the latest access time and access frequency of the cache file according to the constraint conditions, feasible domains and infeasible domains are divided, the storage of the cache file is enabled to be visual, the cache file is divided simply and conveniently, the working conformity of a computer is reduced, and the efficiency of memory cache is improved.
Example 5:
as an embodiment of the present invention: the determining the caching priority order of the cached files according to the target key information includes:
mapping the cache file on the three-dimensional coordinate axis according to the coding sequence by taking the cache time as an X axis and the latest access time line as a Y axis, and determining the coordinate of the cache file;
calculating the distance from the origin of the three-dimensional coordinate axis to the cache file according to the coordinates of the cache file;
sorting the distances and determining the caching priority of the cached files;
the principle of the invention is as follows: according to the method, the X axis, the Y axis and the Z axis are established, the three-dimensional coordinate axis with the access timeline as the base axis is determined, the cache files are sequentially input, the distance from the cache files to the origin is calculated, the cache sequence of the files is determined according to the distance, the cache sequence of the files is calculated based on the access frequency and the access time, the access frequency and the latest access time are tracked, and a user experiences a more self-adaptive algorithm.
The invention has the beneficial effects that: the invention relates to a file caching method, which is characterized in that a cache pool builds a three-dimensional coordinate axis aiming at file caching, tracks access frequency and recent access time, enables the whole algorithm to be more suitable for users to use, automatically adapts to caching of the cache pool, provides a new file idea, provides a new three-dimensional idea, and enables file caching to be more mathematically modeled.
Example 6:
as an embodiment of the present invention: determining the elimination threshold of the cache file according to the key information comprises the following steps:
determining the caching range of the cached file according to the cached file and the latest access time of the key information; wherein the content of the first and second substances,
calculating the number of the cache files according to the memory size of the memory space;
determining the caching range of the cached files according to the number and the file codes;
determining the range of the latest access time and the range of the latest access frequency according to the cache range, and generating a time threshold and a frequency threshold;
determining a elimination threshold of the cache file according to the time threshold and the frequency threshold;
the principle of the invention is as follows: determining a cache range of the cache file according to the cache file, wherein the cache range is used for defining the cache file, determining a first cache file and a last cache file, determining a range of the latest access time and a range of the latest access frequency, generating a time threshold and a frequency threshold by using time and frequency outside the range, determining the range of the time and the range of the frequency, and determining a obsolete threshold of the cache file according to the time threshold and the frequency threshold;
the invention has the beneficial effects that: the cache files are accurately calculated through double calculation of time threshold values and frequency threshold values, elimination threshold values are generated, namely the latest access time of the cache files is limited, from another angle, the frequency threshold values of the cache files are defined, a rectangular area is generated on a coordinate axis due to the fact that the time and the frequency cannot be negative values, the cache files are feasible within the rectangular area when the cache files are screened, the cache files are not feasible within the rectangular area, and the accurate threshold value calculation of the whole cache files is carried out from two aspects.
Example 7:
as an embodiment of the present invention: constructing a constraint condition according to the elimination threshold value to generate a feasible region and an infeasible region, wherein the method comprises the following steps:
generating a two-dimensional coordinate axis which takes the latest access time as a horizontal axis and the access frequency as a vertical axis;
generating a threshold boundary value according to the time threshold value and the frequency threshold value;
mapping the threshold boundary value on the two-dimensional coordinate axis to determine the threshold boundary line;
mapping the threshold boundary line on the two-dimensional coordinate axis to determine a feasible region and an infeasible region,
the step of mapping the threshold boundary line on the two-dimensional coordinate axis to determine a feasible region and an infeasible region comprises the following steps:
step 1: obtaining the boundary threshold value and determining the coordinate of the boundary threshold value lineDetermining a mapping function:
wherein the content of the first and second substances,indicating a boundary threshold lineThe included angle between each coordinate point and the origin;indicating a boundary threshold lineOne seatThe abscissa of the punctuation;indicating a boundary threshold lineThe ordinate of the individual coordinate points;representing spatial coefficients; the above-mentionedIs shown asA normal distribution function of the coordinate points;the total number of coordinates of the boundary threshold line;
step 2: generating a threshold boundary setting model according to the time threshold and the frequency threshold:
wherein the content of the first and second substances,represents a time threshold constant;represents a frequency threshold constant;representing a characteristic value of the feasible region;represents a period;a value of a characteristic of an infeasible area;represents the abscissa middle value;representing the mean value of the abscissa and the mean value of the ordinate;
and step 3: setting a model according to the mapping function and a threshold boundary, and determining a feasible region and an infeasible region;
wherein, when the H < 1, the coordinates (x _ i, y _ i) representing the boundary threshold line and the region in the origin exist an infeasible region; and when the H is larger than or equal to 1, the area of the boundary threshold line representing the coordinates (x _ i, y _ i) and the origin is a feasible area.
The principle of the invention is as follows: and constructing a two-dimensional coordinate axis by using a constraint condition generation principle, generating the two-dimensional coordinate axis with the latest access time as a horizontal axis and the access frequency as a vertical axis, generating a threshold boundary value according to the time threshold and the frequency threshold, mapping the threshold boundary value on the two-dimensional coordinate axis, determining a threshold boundary line, mapping the threshold boundary line on the two-dimensional coordinate axis, and determining a feasible region and an infeasible region, wherein the time threshold and the frequency threshold are used as variables to perform condition limitation on the cache file.
The invention has the beneficial effects that: generating a two-dimensional coordinate axis which takes the latest visit time as a horizontal axis and the visit frequency as a vertical axis; generating a threshold boundary value according to the time threshold value and the frequency threshold value; mapping the threshold boundary value on the two-dimensional coordinate axis to determine the threshold boundary line; mapping the threshold boundary line on the two-position coordinate axis to determine a feasible region and an infeasible region; the whole feasible region is a rectangular area, so that the calculation of the cache file is facilitated, the feasibility of the whole cache file is more clearly and clearly shown, and the algorithm is low in cost and quick in response. The speed of file caching is improved, and the extra time for reading unnecessary cache files during file caching is avoided.
When the feasible region and the infeasible region are calculated, the coordinates of the boundary threshold line are substituted into the exponential mapping function, so that the boundary value is linearized into the mapping function based on the exponent, and the included angle between the coordinate point and the origin and the space coefficient are introduced when the mapping function is determined, so that the generated mapping function is more accurate. When the threshold editing amount model is set, the limit value which can be set by the threshold is determined by constructing the setting model of the boundary based on the time threshold constant and the intermediate value of the horizontal and vertical coordinates of the boundary line between the frequency threshold constant and the threshold. In the last step, the interesting and infeasible areas are determined based on the mapping function and the threshold editing amount setting model, because the threshold boundary setting model is introduced to determine the editing amount, and the mapping function introduces the threshold boundary line, the feasible areas and the infeasible areas can be clearly set according to the threshold boundary line, so that the speed of file caching is improved, and the extra time for reading unnecessary cached files during file caching is avoided.
Example 8:
as an embodiment of the present invention: obtaining an idle memory space, and caching the screening file, including:
acquiring a free memory space, and reading the screening file;
extracting key information of the screened file at regular time, updating the latest access time and access frequency of the screened file in time, and generating a cache result;
and releasing the screening file in time according to the caching result.
The principle of the invention is as follows: the invention reads the screening file by acquiring the free memory space; extracting key information of the screened file at regular time, updating the latest access time and access frequency of the screened file in time, and generating a cache result; and releasing the screening file in time according to the caching result, and releasing the caching pool in the whole process so as to generate a new caching space.
The invention has the beneficial effects that: according to the method and the device, the key information of the screening file is extracted at regular time, the latest access time and the access frequency of the screening file are updated in time, a cache result is generated, the screening file is released in time according to the cache result, the cache file is distributed in time, the whole memory space is expanded, the operation efficiency of the computer is improved, the operation efficiency of the memory of the computer is improved, the screening file is updated in time through scanning the information at regular time, the buffer pool is expanded in time, and the operation efficiency of the computer system is improved.
Example 9:
as an embodiment of the present invention: the screening the cache files according to the time optimization rule to determine the screened files comprises:
determining the range of the cache file according to the feasible region range; wherein the content of the first and second substances,
mapping the latest access time and the access frequency of the cache file to the two-dimensional coordinate axis to generate a mapping result; if the cache file is in the feasible region, determining a screening file, and queuing the screening file;
and if the cache file is in the infeasible area, releasing the cache file.
The principle of the invention is as follows: and generating a function by determining whether the cache file is calculated in a feasible region, extracting key information of the cache file, calculating the function by using the latest access time and the access frequency as variables, mapping the function to the two-dimensional coordinate axis, judging whether the cache file is in the feasible region, generating a screening file if the cache file is in the feasible region, waiting in line, and releasing the cache file if the cache file is not in the feasible region.
The invention has the beneficial effects that: the method comprises the steps of generating feasible areas and infeasible areas through constraint conditions to constrain cache files, generating a constraint target, constructing a time optimization rule, and performing time optimization on the cache files, so that the expenditure time of the cache files is reduced, and the caching efficiency of the cache files is improved.
Example 10: the screening file is imported into a preset cache pool, and the screening file is cached, including
Scanning key information of the screened file regularly through a preset cache pool, updating the latest access time and the access frequency of the screened file in time, and generating a cache result;
releasing the cache file in time according to the cache result to obtain an idle cache pool;
based on the idle cache pool, sequentially reading key codes of key information of the screening files;
and sequentially reading the screening files into the idle cache pool according to the key codes.
The principle of the invention is as follows: scanning key information of the screened file regularly through the cache pool, updating the latest access time and access frequency of the screened file in time, and generating a cache result; releasing the cache file in time according to the cache result to obtain an idle cache pool; based on the free cache pool, sequentially reading key codes of key information of the screened files; and according to the key codes, the free cache pool sequentially reads the screening files, the free cache pool sequentially caches the screening files, and the time is effectively controlled.
The invention has the beneficial effects that: the cache pool scans key information of the screened file at regular time, which is equal to the work of circularly extracting file information, so that the whole process is more data, the latest access time and access frequency of the screened file are updated in time, a cache result is generated, multiple accesses are performed, the cache result is more accurate, the cache file is released in time according to the cache result, the memory of the cache pool is released in time, the memory of the cache pool is cleared in time, and an idle cache pool is obtained; and based on the free cache pool, sequentially reading key codes of key information of the screened files, repeating the reading of the initial files, sequentially reading the screened files by the free cache pool according to the key codes, and sequentially storing the screened files.
It will be apparent to those skilled in the art that various changes and modifications may be made in the present invention without departing from the spirit and scope of the invention. Thus, if such modifications and variations of the present invention fall within the scope of the claims of the present invention and their equivalents, the present invention is also intended to include such modifications and variations.

Claims (6)

1. A time optimization method for file caching is characterized by comprising the following steps:
obtaining a cache file, accessing key information of the cache file at regular time, and determining target key information;
constructing a cache time optimization rule through the target key information and preset constraint conditions;
screening the cache files according to the cache time optimization rule to determine screened files;
importing the screening file into a preset cache pool, and caching the screening file; the obtaining of the cache file, accessing the key information of the cache file at regular time, and determining the target key information include:
obtaining the cache file and determining a key path of the cache file;
searching key information of the cache file according to the key path;
determining the access times of the cache files according to the key information of the cache files;
accumulating the interval duration of the access times of the cache files according to the access times of the cache files, and determining the average duration;
determining the time interval for accessing the cache file at regular time according to the average time length;
scanning the target key information of the cache file at regular time according to the time interval, and recording the target key information of the cache file
The target key information also comprises file codes, file sizes, the latest access time of the files and the access frequency of the files; wherein the content of the first and second substances,
the file code is used for uniquely marking the file;
sequencing the file codes and determining a coding sequence;
acquiring an idle memory space, and calculating the caching time of the caching file according to the size of the caching file;
based on the memory space and according to the latest access time of the cache files, time sequencing is carried out on the cache files, and the latest access time line is determined;
the file access frequency is used for carrying out frequency sequencing on the cache files and determining the sequence of the most access frequencies;
the method for constructing the cache time optimization rule through the target key information and the preset constraint conditions comprises the following steps:
determining the caching priority of the caching files according to the target key information;
determining an elimination threshold of the cache file according to the target key information;
constructing constraint conditions according to the elimination threshold value to generate feasible regions and infeasible regions;
according to the cache priority, constructing a time optimization rule based on the elimination threshold and the constraint condition;
the determining the caching priority order of the cached files according to the target key information includes:
determining a three-dimensional coordinate axis which takes the access time line as a base axis by taking the cache time as an X axis, the latest access time line as a Y axis and the most access frequency sequence as a Z axis;
mapping the cache file on the three-dimensional coordinate axis according to the coding sequence, and determining the coordinate of the cache file;
calculating the distance from the origin of the three-dimensional coordinate axis to the cache file according to the coordinates of the cache file;
sorting the distances and determining a sorting result;
and determining the caching priority of the cached files according to the sequencing result.
2. The method of claim 1, wherein the determining the elimination threshold of the cached file according to the target key information comprises:
determining the caching range of the cached file according to the cached file and the latest access time of the target key information; wherein the content of the first and second substances,
calculating the number of the cache files according to the memory size of the memory space;
determining the caching range of the cached files according to the number and the file codes;
determining the range of the latest access time and the range of the latest access frequency according to the cache range, and generating a time threshold and a frequency threshold;
and determining the elimination threshold of the cache file according to the time threshold and the frequency threshold.
3. The method of claim 2, wherein the constructing a constraint condition according to the culling threshold to generate feasible regions and infeasible regions comprises:
generating a two-dimensional coordinate axis which takes the latest access time as a horizontal axis and the access frequency as a vertical axis;
generating a threshold boundary value according to the time threshold value and the frequency threshold value;
mapping the threshold boundary value on the two-dimensional coordinate axis to determine a threshold boundary line;
mapping the threshold boundary line on the two-dimensional coordinate axis to determine a feasible region and an infeasible region; wherein the content of the first and second substances,
the step of mapping the threshold boundary line on the two-dimensional coordinate axis to determine a feasible region and an infeasible region comprises the following steps:
step 1: obtaining boundary threshold value, determining coordinate of boundary threshold value lineDetermining a mapping function:
wherein the content of the first and second substances,indicating a boundary threshold lineThe included angle between each coordinate point and the origin;indicating a boundary threshold lineThe abscissa of each coordinate point;indicating a boundary threshold lineThe ordinate of the individual coordinate points;representing spatial coefficients; the above-mentionedIs shown asA normal distribution function of the coordinate points;the total number of coordinates of the boundary threshold line;
step 2: generating a threshold boundary setting model according to the time threshold and the frequency threshold:
wherein the content of the first and second substances,represents a time threshold constant;represents a frequency threshold constant;representing a characteristic value of the feasible region;represents a period;a value of a characteristic of an infeasible area;represents the abscissa middle value;representing the mean value of the abscissa and the mean value of the ordinate;
and step 3: setting a model according to the mapping function and a threshold boundary, and determining a feasible region and an infeasible region;
wherein whenCoordinates of the boundary threshold lineAn infeasible region exists with a region within the origin; when in useCoordinates of the boundary threshold lineThe region within the origin is the feasible region.
4. The method according to claim 1, wherein the constructing a time optimization rule based on the culling threshold and the constraint condition according to the cache priority order comprises:
acquiring coordinate points of the cache file according to the three-dimensional coordinate axis of the cache priority order;
determining a time optimization algorithm of the cache file according to the coordinate point, the elimination threshold and the constraint condition and a preset algorithm;
and constructing a time optimization rule according to the time optimization algorithm.
5. The method according to claim 3, wherein the screening the cached files according to the caching time optimization rule to determine the screened files comprises:
determining the range of the cache file according to the range of the feasible region;
mapping the latest access time and the access frequency of the cache file to the two-dimensional coordinate axis to generate a mapping result;
if the cache file is in the feasible region, determining a screening file, and queuing the screening file;
and if the cache file is in the infeasible area, releasing the cache file.
6. The method according to claim 1, wherein the importing the filter file into a preset buffer pool and caching the filter file comprises:
scanning key information of the screened file regularly through a preset cache pool, updating the latest access time and the access frequency of the screened file in time, and generating a cache result;
releasing the cache file in time according to the cache result to obtain an idle cache pool;
based on the idle cache pool, sequentially reading key codes of key information of the screening files;
and sequentially reading the screening files into the idle cache pool according to the key codes.
CN202110051596.8A 2021-01-15 2021-01-15 Time optimization method for file caching Active CN112363986B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202110051596.8A CN112363986B (en) 2021-01-15 2021-01-15 Time optimization method for file caching

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202110051596.8A CN112363986B (en) 2021-01-15 2021-01-15 Time optimization method for file caching

Publications (2)

Publication Number Publication Date
CN112363986A CN112363986A (en) 2021-02-12
CN112363986B true CN112363986B (en) 2021-07-02

Family

ID=74535032

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202110051596.8A Active CN112363986B (en) 2021-01-15 2021-01-15 Time optimization method for file caching

Country Status (1)

Country Link
CN (1) CN112363986B (en)

Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102511043A (en) * 2011-11-26 2012-06-20 华为技术有限公司 Method for replacing cache files, device and system thereof
CN106528761A (en) * 2016-11-04 2017-03-22 郑州云海信息技术有限公司 File caching method and apparatus
CN106899692A (en) * 2017-03-17 2017-06-27 重庆邮电大学 A kind of content center network node data buffer replacing method and device
CN108650544A (en) * 2018-05-17 2018-10-12 上海七牛信息技术有限公司 A kind of media playing method, device and media play system
CN111813715A (en) * 2020-06-29 2020-10-23 湖南快乐阳光互动娱乐传媒有限公司 Data caching method and device based on accessed times
CN111917882A (en) * 2020-08-07 2020-11-10 湖南快乐阳光互动娱乐传媒有限公司 File caching method and device and electronic equipment

Family Cites Families (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US6918113B2 (en) * 2000-11-06 2005-07-12 Endeavors Technology, Inc. Client installation and execution system for streamed applications

Patent Citations (6)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102511043A (en) * 2011-11-26 2012-06-20 华为技术有限公司 Method for replacing cache files, device and system thereof
CN106528761A (en) * 2016-11-04 2017-03-22 郑州云海信息技术有限公司 File caching method and apparatus
CN106899692A (en) * 2017-03-17 2017-06-27 重庆邮电大学 A kind of content center network node data buffer replacing method and device
CN108650544A (en) * 2018-05-17 2018-10-12 上海七牛信息技术有限公司 A kind of media playing method, device and media play system
CN111813715A (en) * 2020-06-29 2020-10-23 湖南快乐阳光互动娱乐传媒有限公司 Data caching method and device based on accessed times
CN111917882A (en) * 2020-08-07 2020-11-10 湖南快乐阳光互动娱乐传媒有限公司 File caching method and device and electronic equipment

Also Published As

Publication number Publication date
CN112363986A (en) 2021-02-12

Similar Documents

Publication Publication Date Title
TWI702506B (en) System, machine readable medium, and machine-implemenated method for merge tree garbage metrics
TWI719281B (en) A system, machine readable medium, and machine-implemented method for stream selection
TWI702503B (en) Systems, methods, and computer readable media to implement merge tree modifications for maintenance operations
CN1214325C (en) Methods and apparatus for improving locality of reference through memory management
US20060074872A1 (en) Adaptive database buffer memory management using dynamic SQL statement cache statistics
US7181437B2 (en) Associative database scanning and information retrieval
US6807607B1 (en) Cache memory management system and method
TW201841122A (en) Key-value store tree
CN108710639B (en) Ceph-based access optimization method for mass small files
CN102236674B (en) Method and device for updating index page
JP5040396B2 (en) Web page search program, method, and apparatus
CN1855094A (en) Method and device for processing electronic files of users
WO2002035361A2 (en) Method and apparatus for improving the efficiency of cache memories using stored activity measures
CN110472004B (en) Method and system for multi-level cache management of scientific and technological information data
CN108241615A (en) Data duplicate removal method and device
CN102955812B (en) A kind of method of index building storehouse, device and querying method and device
JPH10240766A (en) Information retrieval method and device therefor
CN112363986B (en) Time optimization method for file caching
JP2007034878A (en) Information processing method, information processor, and information processing program
CN113626483A (en) Front-end caching method, system, equipment and storage medium for filling forms
CN107239558A (en) Common interconnection network collecting method
CN109992603B (en) Data searching method and device, electronic equipment and computer readable medium
CN111158601A (en) IO data flushing method, system and related device in cache
CN107506156B (en) Io optimization method of block device
CN106991060B (en) Elimination optimization method and device for read cache

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