CN110519394A - A kind of information cache method of replacing, device, terminal and storage medium - Google Patents
A kind of information cache method of replacing, device, terminal and storage medium Download PDFInfo
- Publication number
- CN110519394A CN110519394A CN201910866387.1A CN201910866387A CN110519394A CN 110519394 A CN110519394 A CN 110519394A CN 201910866387 A CN201910866387 A CN 201910866387A CN 110519394 A CN110519394 A CN 110519394A
- Authority
- CN
- China
- Prior art keywords
- resource
- coefficient
- information
- cache
- caching
- 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
Links
Classifications
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
-
- H—ELECTRICITY
- H04—ELECTRIC COMMUNICATION TECHNIQUE
- H04L—TRANSMISSION OF DIGITAL INFORMATION, e.g. TELEGRAPHIC COMMUNICATION
- H04L67/00—Network arrangements or protocols for supporting network services or applications
- H04L67/50—Network services
- H04L67/56—Provisioning of proxy services
- H04L67/568—Storing data temporarily at an intermediate stage, e.g. caching
- H04L67/5682—Policies or rules for updating, deleting or replacing the stored data
Abstract
This application discloses a kind of information cache method of replacing, device, terminal and storage medium, the type of value coefficient that the application is calculated by the way that the resource type based on cache resources is added, the corresponding request cost coefficient of resource consumption generated based on cache resources transmission and the caching validity period accounting coefficient based on caching resource duration calculation, calculate the caching value coefficient of cache resources jointly in conjunction with request time interval coefficient, it solves existing caching replacement strategy and determines that the mode of the caching value of resource is excessively single only according to the access frequency of resource and with access times, it is difficult to comprehensively, the technical issues of accurately being replaced according to caching resource value.
Description
Technical field
This application involves information technology fields more particularly to a kind of information cache method of replacing, device, terminal and storage to be situated between
Matter.
Background technique
With internet scale constantly become larger and amount of access it is increasing, the use of caching is at breakthrough performance bottle
The key factor of neck plays the role of vital.But, it is contemplated that the limited storage resource of hardware device, it is impossible to will
All information resources all cache, this has suitable Replacement Strategy with regard to inevitable requirement to constantly update in caching
Hold, to guarantee to improve caching effect as wide as possible under certain memory space.
Existing caching replacement strategy usually determines that caching resource is worth according to the popular degree of resource, i.e. access times
Less or access frequency it is lower resource value it is lower, it is easier to be replaced, cause existing caching replacement strategy excessively
It is single, it is difficult to the technical issues of being replaced is worth according to caching resource comprehensively, accurately.
Summary of the invention
This application provides a kind of information cache method of replacing, device, terminal and storage mediums, existing slow for solving
It is excessively single to deposit Replacement Strategy, it is difficult to the technical issues of being replaced is worth according to caching resource comprehensively, accurately.
In view of this, the application first aspect provides a kind of information cache method of replacing, comprising:
S1, according to stored first cache resources, extract the parameter information of first cache resources, wherein described
Parameter information includes resource type information, resource size information, latest requests temporal information, for the first time cache-time information and resource
Expired time information;
S2, according to the resource type parameter, determine resource type set corresponding with first cache resources, and true
The resource temperature impact factor and resource type temperature of the fixed resource group, and according to the resource temperature impact factor and resource
The type of value coefficient of the resource type set is calculated in type temperature, wherein the resource temperature impact factor is specific
For the request number of times of the resource type set described in preset time interval and the ratio of total request number of times, the resource type
Temperature is the parameter being positively correlated with the resource temperature impact factor;
S3, according to the sum of the resource size information and preset resource transmission cost parameter, obtain first caching
The request cost coefficient of resource;
S4, according to the difference of the latest requests temporal information and current time information, obtain first cache resources
Request time interval coefficient;
S5, basis cache-time information, the resource expired time information and the current time information for the first time,
The caching validity period accounting coefficient of first cache resources is calculated;
S6, according to the type of value coefficient and the request cost coefficient, request time interval coefficient, described be cached with
The ratio of effect phase accounting coefficient obtains the corresponding caching value coefficient of first cache resources;
S7, circulation execute step S1 to S6, successively calculate the caching value coefficient of stored each first cache resources;
S8, it is ranked up according to the caching value coefficients of each first cache resources;
S9, minimum the first cache resources of one or more of caching value coefficient value are replaced with into the second caching to be cached
Resource.
Optionally, the step S2 is specifically included:
According to the resource type parameter, resource type set corresponding with first cache resources is determined, and determine
The resource temperature impact factor and resource type temperature of the resource group, and according to the resource temperature impact factor and resources-type
Type temperature obtains the type of value coefficient of the resource type set by preset type of value coefficient formulas,
In, the type of value coefficient formulas specifically:
In formula, TiIndicate the type of value coefficient of i-th of resource type set, λiIndicate the resource temperature shadow of the i-th class resource
Ring the factor, PiIt is positively correlated for the resource type temperature and with the resource temperature impact factor, SiFor in preset time zone
The request number of times of the interior resource type set, S are total request number of times in preset time interval.
Optionally, the step S3 is specifically included:
According to the resource size information and preset resource transmission cost parameter, pass through preset request cost coefficient meter
Formula is calculated, obtains the request cost coefficient of first cache resources, wherein the request cost coefficient calculation formula is specific
Are as follows:
H=Hops*Pr+fileSize;
In formula, H is the request cost coefficient, and Hops is network hops needed for transmission, PrFor the required transmission of single-hop
Cost parameter, fileSize are the resource size information.
Optionally, the step S5 is specifically included:
According to the information of cache-time for the first time, the resource expired time information and the current time information, lead to
Preset caching validity period accounting coefficient formulas is crossed, the caching validity period accounting system of first cache resources is calculated
Number, wherein the caching validity period accounting coefficient formulas specifically:
In formula, E is the caching validity period accounting coefficient, and expireTime is the resource expired time information,
NowTime is the current time information, and cacheTime is the cache-time information for the first time.
Optionally, the step S6 is specifically included:
It is effective according to the type of value coefficient and the request cost coefficient, request time interval coefficient, the caching
Phase accounting coefficient obtains the corresponding caching value of first cache resources by preset caching value coefficient calculation formula
Coefficient, wherein the caching value coefficient calculation formula specifically:
Vj=Ti*(1/Ij*Hj*Ej),j∈i;
In formula, VjFor the caching value coefficient of j-th of first cache resources.
Optionally, the step S9 is specifically included:
S91, according to the first cache resources after sequence, remove the first minimum cache resources of caching value coefficient;
The total resources size information of S92, removed first cache resources of statistics, if residual memory space is not less than to slow
The resource size information for the second cache resources deposited, thens follow the steps S93, if it is not, then return step S91;
S93, deposit second cache resources.
Optionally, the parameter information further include: personal secrets are related to type information;
After the step S8 further include:
S81, identical first cache resources of caching value coefficient are judged whether there is, if so, S82 is thened follow the steps, if
It is no to then follow the steps S9.
Step S82, the replacement priority for relating to hidden first cache resources is set as relating on hidden first cache resources non-,
Described in relate to hidden first cache resources be the first cache resources that personal secrets are related to that type information is yes, it is described non-to relate to hidden first
Cache resources are the first cache resources that personal secrets are related to that type information is no.The application second aspect provides a kind of information
Caching replacement device, comprising:
First cache resources parameter acquiring unit, for it is slow to extract described first according to stored first cache resources
Deposit the parameter information of resource, wherein the parameter information includes resource type information, resource size information, latest requests time
Information, for the first time cache-time information and resource expired time information;
Type of value coefficient calculation unit, for according to the resource type parameter, determining and first cache resources
Corresponding resource type set, and determine the resource temperature impact factor and resource type temperature of the resource group, and according to institute
Resource temperature impact factor and resource type temperature are stated, the type of value coefficient of the resource type set is calculated, wherein
The resource temperature impact factor be specially in preset time interval the request number of times of the resource type set with always ask
The ratio of number is sought, the resource type temperature is the parameter being positively correlated with the resource temperature impact factor;
Cost coefficient computing unit is requested, for according to the resource size information and preset resource transmission cost parameter
The sum of, obtain the request cost coefficient of first cache resources;
Request time interval coefficient computing unit, for according to the latest requests temporal information and current time information
Difference obtains the request time interval coefficient of first cache resources;
Validity period accounting coefficient calculation unit is cached, for cache-time information, the resource to be expired for the first time according to
The caching validity period accounting coefficient of first cache resources is calculated in temporal information and the current time information;
Value coefficient computing unit is cached, according to the type of value coefficient and the request cost coefficient, request time
The ratio of interval coefficient, the caching validity period accounting coefficient, obtains the corresponding caching value coefficient of first cache resources;
Resource sequencing unit, for being ranked up according to the caching value coefficient of each first cache resources;
Resource replacement unit, for will cache minimum the first cache resources of one or more of value coefficient value replace with to
Second cache resources of caching.
The application third aspect provides a kind of terminal device, comprising: memory and processor;
The memory is for storing journey corresponding with the information cache method of replacing as described in the application first aspect
Sequence code;
The processor is for executing said program code.
The application fourth aspect provides a kind of storage medium, is stored in the storage medium and the application first aspect
The corresponding program code of information cache method of replacing.
As can be seen from the above technical solutions, the application has the following advantages:
This application provides a kind of information cache method of replacing, comprising: S1, according to stored first cache resources is mentioned
Take the parameter information of first cache resources, wherein the parameter information include resource type information, resource size information,
Latest requests temporal information, for the first time cache-time information and resource expired time information;S2, according to the resource type parameter,
Determine corresponding with first cache resources resource type set, and determine the resource temperature impact factor of the resource group with
Resource type temperature, and according to the resource temperature impact factor and resource type temperature, the resource type collection is calculated
The type of value coefficient of conjunction, wherein the resource temperature impact factor is specially described resources-type in preset time interval
The ratio of the request number of times of type set and total request number of times, the resource type temperature are to be in the resource temperature impact factor
Positively related parameter;S3, according to the sum of the resource size information and preset resource transmission cost parameter, obtain described first
The request cost coefficient of cache resources;S4, according to the difference of the latest requests temporal information and current time information, obtain institute
State the request time interval coefficient of the first cache resources;S5, basis the cache-time information, the resource expired time for the first time
The caching validity period accounting coefficient of first cache resources is calculated in information and the current time information;S6, basis
The type of value coefficient and the request cost coefficient, request time interval coefficient, the caching validity period accounting coefficient
Ratio obtains the corresponding caching value coefficient of first cache resources;S7, circulation execute step S1 to S6, successively calculate
The caching value coefficient of each first cache resources of storage;S8, according to the caching valence of each first cache resources
Value coefficient is ranked up;S9, will cache minimum the first cache resources of one or more of value coefficient value replace with it is to be cached
Second cache resources.
The application is by being added the type of value coefficient of the resource type calculating based on cache resources, being passed based on cache resources
The corresponding request cost coefficient of the resource consumption of defeated generation and the caching validity period accounting based on caching resource duration calculation
Coefficient calculates the caching value coefficient of cache resources in conjunction with request time interval coefficient jointly, solves existing caching and sets
It changes strategy and determines that the mode of the caching value of resource is excessively single only according to the access frequency of resource and with access times, it is difficult to is complete
Face, accurately according to caching resource value replaced the technical issues of.
Detailed description of the invention
In order to illustrate the technical solutions in the embodiments of the present application or in the prior art more clearly, to embodiment or will show below
There is attached drawing needed in technical description to be briefly described, it should be apparent that, the accompanying drawings in the following description is only this
Some embodiments of application without any creative labor, may be used also for those of ordinary skill in the art
To obtain other attached drawings according to these attached drawings.
Fig. 1 is a kind of flow diagram of one embodiment of information cache method of replacing provided by the present application;
Fig. 2 is a kind of flow diagram of second embodiment of information cache method of replacing provided by the present application;
Fig. 3 is a kind of structural schematic diagram of one embodiment of information cache displacement apparatus provided by the present application.
Specific embodiment
The embodiment of the present application provides a kind of information cache method of replacing, device, terminal and storage medium, existing for solving
Some caching replacement strategies are excessively single, it is difficult to be worth the technical issues of being replaced according to caching resource comprehensively, accurately.
To enable present invention purpose, feature, advantage more obvious and understandable, below in conjunction with the application
Attached drawing in embodiment, the technical scheme in the embodiment of the application is clearly and completely described, it is clear that disclosed below
Embodiment be only some embodiments of the present application, and not all embodiment.Based on the embodiment in the application, this field
Those of ordinary skill's all other embodiment obtained without making creative work belongs to the application protection
Range.
Referring to Fig. 1, the embodiment of the present application provides a kind of information cache method of replacing, comprising:
S1, according to stored first cache resources, extract the parameter information of the first cache resources.
Wherein, parameter information includes resource type information, resource size information, latest requests temporal information, caches for the first time
Temporal information and resource expired time information;
S2, according to resource type parameter, determine resource type set corresponding with the first cache resources, and determination resource group
Resource temperature impact factor and resource type temperature calculate and according to resource temperature impact factor and resource type temperature
To the type of value coefficient of resource type set.
Wherein, the resource type of the present embodiment specifically includes video, game, audio, webpage etc., the resource of each type
Type set has the impact factor λ i of oneself, and resource temperature impact factor is specially the resource in preset time interval
The ratio of the request number of times of type set and total request number of times, resource type temperature can be by initializing preset one for one
Parameter value, and after initialization, numerical value change and the resource temperature impact factor of the resource type temperature are positively correlated.
More specifically, the step S2 of the present embodiment is specifically included:
According to resource type parameter, resource type set corresponding with the first cache resources is determined, and determine resource group
Resource temperature impact factor and resource type temperature, and according to resource temperature impact factor and resource type temperature, by preset
Type of value coefficient formulas, obtain the type of value coefficient of resource type set, wherein type of value coefficient calculates public
Formula specifically:
In formula, TiIndicate the type of value coefficient of i-th of resource type set, λiIndicate the resource temperature shadow of the i-th class resource
Ring the factor, PiIt is positively correlated for resource type temperature and with resource temperature impact factor, SiFor the resource in preset time interval
The request number of times of type set, S are total request number of times in preset time interval.
S3, according to the sum of resource size information and preset resource transmission cost parameter, obtain asking for the first cache resources
Seek cost coefficient.
Specifically, the step S3 of the present embodiment is specifically included: according to resource size information and preset resource transmission cost
Parameter obtains the request cost coefficient of the first cache resources by preset request cost coefficient calculation formula, wherein request
Cost coefficient calculation formula specifically:
H=Hops*Pr+fileSize;
In formula, H is request cost coefficient, and Hops is network hops needed for transmission, PrFor the required transmission cost of single-hop
Parameter, fileSize are resource size information.
The product of transmission cost needed for network hops and single-hop is above-mentioned resource transmission cost parameter, transmission cost ginseng
Number can pre-set corresponding numerical value by actual network environment, and details are not described herein.
S4, according to the difference of latest requests temporal information and current time information, when obtaining the request of the first cache resources
Between interval coefficient.
It is requested more specifically, the latest requests temporal information of the present embodiment refers specifically to the first cache resources the last time
Temporal information, specific request time interval coefficient calculation formula are as follows:
I=nowTime-useTime;
In formula, I indicates request time interval coefficient, and nowTime indicates current time, and useTime indicates that the last time asks
Seeking time.
S5, according to cache-time information, resource expired time information and current time information for the first time, be calculated first
The caching validity period accounting coefficient of cache resources.
More specifically, the step S5 of the present embodiment is specifically included: being believed according to cache-time information for the first time, resource expired time
By preset caching validity period accounting coefficient formulas the first cache resources are calculated in breath and current time information
Caching validity period accounting coefficient, wherein caching validity period accounting coefficient formulas specifically:
In formula, E is caching validity period accounting coefficient, and expireTime is resource expired time information, and nowTime is current
Temporal information, cacheTime are cache-time information for the first time.
S6, according to type of value coefficient and request cost coefficient, request time interval coefficient, caching validity period accounting coefficient
Ratio, obtain the corresponding caching value coefficient of the first cache resources.
More specifically, the step S6 of the present embodiment is specifically included:
According to type of value coefficient and request cost coefficient, request time interval coefficient, caching validity period accounting coefficient, lead to
Preset caching value coefficient calculation formula is crossed, the corresponding caching value coefficient of the first cache resources is obtained, wherein caching value
Coefficient formulas specifically:
Vj=Ti*(1/Ij*Hj*Ej),j∈i;
In formula, VjFor the caching value coefficient of j-th of first cache resources, wherein j ∈ i indicates that the first cache resources j belongs to
In resource type set i.
S7, judge whether that the caching value coefficient of all stored each first cache resources has been calculated, if it is not, then returning
Step S1 is returned, the caching value coefficient of stored each first cache resources is successively calculated, if so, thening follow the steps S8.
S8, it is ranked up according to the caching value coefficients of each first cache resources.
S9, minimum the first cache resources of one or more of caching value coefficient value are replaced with into the second caching to be cached
Resource.
The application is by being added the type of value coefficient of the resource type calculating based on cache resources, being passed based on cache resources
The corresponding request cost coefficient of the resource consumption of defeated generation and the caching validity period accounting based on caching resource duration calculation
Coefficient calculates the caching value coefficient of cache resources in conjunction with request time interval coefficient jointly, solves existing caching and sets
It changes strategy and determines that the mode of the caching value of resource is excessively single only according to the access frequency of resource and with access times, it is difficult to is complete
Face, accurately according to caching resource value replaced the technical issues of.
Meanwhile the present embodiment also passes through sequence, and caching is preferentially worth the first low cache resources when replacing and is set
It swaps out, system can be made to be maintained at caching value maximization state, be conducive to the maximization that spatial cache utilizes.
The above are a kind of detailed description of one embodiment of information cache method of replacing provided by the present application, here is
A kind of detailed description of second embodiment of information cache method of replacing provided by the present application.
Referring to Fig. 2, on the basis of above-mentioned the application one embodiment,
After step S8 further include:
S81, identical first cache resources of caching value coefficient are judged whether there is, if so, S82 is thened follow the steps, if
It is no to then follow the steps S9.
Step S82, the replacement priority for relating to hidden first cache resources is set as relating on hidden first cache resources non-,
Described in relate to hidden first cache resources be the first cache resources that personal secrets are related to that type information is yes, it is described non-to relate to hidden first
Cache resources are the first cache resources that personal secrets are related to that type information is no.
It should be noted that the parameter information referred in the application one embodiment further include: personal secrets are related to class
Type information;
The caching resource value for being related to privacy of user safety is lower, when two resources are cached in the case where considering other 4 factors
When being worth identical, preferentially the Resource exchange for being related to personal secrets is gone out, caching few as far as possible is related to the resource of privacy of user.
Specific implementation means can use, and be added in the metadata from field privacySecurity, and 0 indicates not to be related to
Personal secrets, 1 indicates to be related to personal secrets.
In addition, step S9 is specifically included:
S91, according to the first cache resources after sequence, remove the first minimum cache resources of caching value coefficient;
The total resources size information of S92, removed first cache resources of statistics, if residual memory space is not less than to slow
The resource size information for the second cache resources deposited, thens follow the steps S93, if it is not, then return step S91;
S93, the second cache resources of deposit.
It should be noted that for the m resource to replace away, value can be calculated, while after displacement
Residual memory space is also that can calculate, it is only necessary to which the resource for finding out minimum value in caching system is replaced away, directly one by one
Until memory space is stored in resource y enough, it is ensured that the resource quantity replaced away is minimum, while the resource replaced away is total
Value wants minimum.Therefore it may only be necessary to based on sequence as a result, m Resource exchange the smallest in caching system is gone out, then deposit
Enter resource y, it can system is made to reach maximum value state.
The above are a kind of detailed description of second embodiment of information cache method of replacing provided by the present application, here is
A kind of detailed description of one embodiment of information cache displacement apparatus provided by the present application.
Referring to Fig. 3, the embodiment of the present application provides a kind of information cache displacement apparatus, comprising:
First cache resources parameter acquiring unit 01, for extracting the first caching according to stored first cache resources
The parameter information of resource, wherein parameter information includes resource type information, resource size information, latest requests temporal information, head
Secondary cache-time information and resource expired time information;
Type of value coefficient calculation unit 02, for according to resource type parameter, determination to be corresponding with the first cache resources
Resource type set, and determine the resource temperature impact factor and resource type temperature of resource group, and influence according to resource temperature
The type of value coefficient of resource type set is calculated in the factor and resource type temperature, wherein resource temperature impact factor tool
Body is the ratio of the request number of times of resource type set and total request number of times in preset time interval, and resource type temperature is
The parameter being positively correlated with resource temperature impact factor;
Request cost coefficient computing unit 03, for according to resource size information and preset resource transmission cost parameter it
With obtain the request cost coefficient of the first cache resources;
Request time interval coefficient computing unit 04, for the difference according to latest requests temporal information and current time information
Value, obtains the request time interval coefficient of the first cache resources;
Validity period accounting coefficient calculation unit 05 is cached, for according to cache-time information for the first time, resource expired time letter
Breath and current time information, are calculated the caching validity period accounting coefficient of the first cache resources;
Value coefficient computing unit 06 is cached, according to type of value coefficient and request cost coefficient, request time interval system
The ratio of number, caching validity period accounting coefficient, obtains the corresponding caching value coefficient of the first cache resources;
Resource sequencing unit 07, for being ranked up according to the caching value coefficient of each first cache resources;
Resource replacement unit 08 is replaced with for that will cache minimum the first cache resources of one or more of value coefficient value
Second cache resources to be cached.
In addition, present invention also provides a kind of embodiments of terminal device, comprising: memory and processor;
Memory is for storing program code corresponding with the information cache method of replacing of such as the application first aspect;
Processor is for executing program code.
This application provides a kind of embodiment of storage medium, it is stored in the storage medium and the application first aspect
The corresponding program code of information cache method of replacing.
It is apparent to those skilled in the art that for convenience and simplicity of description, the system of foregoing description,
The specific work process of device and unit, can refer to corresponding processes in the foregoing method embodiment, and details are not described herein.
In several embodiments provided herein, it should be understood that disclosed system, device and method can be with
It realizes by another way.For example, the apparatus embodiments described above are merely exemplary, for example, the unit
It divides, only a kind of logical function partition, there may be another division manner in actual implementation, such as multiple units or components
It can be combined or can be integrated into another system, or some features can be ignored or not executed.Another point, it is shown or
The mutual coupling, direct-coupling or communication connection discussed can be through some interfaces, the indirect coupling of device or unit
It closes or communicates to connect, can be electrical property, mechanical or other forms.
The description of the present application and term " first " in above-mentioned attached drawing, " second ", " third ", " the 4th " etc. are (if deposited
) it is to be used to distinguish similar objects, without being used to describe a particular order or precedence order.It should be understood that use in this way
Data are interchangeable under appropriate circumstances, so that embodiments herein described herein for example can be in addition to illustrating herein
Or the sequence other than those of description is implemented.In addition, term " includes " and " having " and their any deformation, it is intended that
Cover it is non-exclusive include, for example, containing the process, method, system, product or equipment of a series of steps or units need not limit
In step or unit those of is clearly listed, but may include be not clearly listed or for these process, methods, produce
The other step or units of product or equipment inherently.
The unit as illustrated by the separation member may or may not be physically separated, aobvious as unit
The component shown may or may not be physical unit, it can and it is in one place, or may be distributed over multiple
In network unit.It can select some or all of unit therein according to the actual needs to realize the mesh of this embodiment scheme
's.
It, can also be in addition, the functional units in various embodiments of the present invention may be integrated into one processing unit
It is that each unit physically exists alone, can also be integrated in one unit with two or more units.Above-mentioned integrated list
Member both can take the form of hardware realization, can also realize in the form of software functional units.
If the integrated unit is realized in the form of SFU software functional unit and sells or use as independent product
When, it can store in a computer readable storage medium.Based on this understanding, technical solution of the present invention is substantially
The all or part of the part that contributes to existing technology or the technical solution can be in the form of software products in other words
It embodies, which is stored in a storage medium, including some instructions are used so that a computer
Equipment (can be personal computer, server or the network equipment etc.) executes the complete of each embodiment the method for the present invention
Portion or part steps.And storage medium above-mentioned includes: USB flash disk, mobile hard disk, read-only memory (ROM, Read-Only
Memory), random access memory (RAM, Random Access Memory), magnetic or disk etc. are various can store journey
The medium of sequence code.
The above, above embodiments are only to illustrate the technical solution of the application, rather than its limitations;Although referring to before
Embodiment is stated the application is described in detail, those skilled in the art should understand that: it still can be to preceding
Technical solution documented by each embodiment is stated to modify or equivalent replacement of some of the technical features;And these
It modifies or replaces, the spirit and scope of each embodiment technical solution of the application that it does not separate the essence of the corresponding technical solution.
Claims (10)
1. a kind of information cache method of replacing characterized by comprising
S1, according to stored first cache resources, extract the parameter information of first cache resources, wherein the parameter
Information includes resource type information, resource size information, latest requests temporal information, cache-time information and resource are expired for the first time
Temporal information;
S2, according to the resource type parameter, determine resource type set corresponding with first cache resources, and determination institute
The resource temperature impact factor and resource type temperature of resource group are stated, and according to the resource temperature impact factor and resource type
The type of value coefficient of the resource type set is calculated in temperature, wherein the resource temperature impact factor specially exists
The ratio of the request number of times of the resource type set and total request number of times in preset time interval, the resource type temperature
For the parameter being positively correlated with the resource temperature impact factor;
S3, according to the sum of the resource size information and preset resource transmission cost parameter, obtain first cache resources
Request cost coefficient;
S4, according to the difference of the latest requests temporal information and current time information, obtain asking for first cache resources
Seeking time interval coefficient;
S5, basis cache-time information, the resource expired time information and the current time information for the first time, calculate
Obtain the caching validity period accounting coefficient of first cache resources;
S6, according to the type of value coefficient and the request cost coefficient, request time interval coefficient, the caching validity period
The ratio of accounting coefficient obtains the corresponding caching value coefficient of first cache resources;
S7, circulation execute step S1 to S6, successively calculate the caching value coefficient of stored each first cache resources;
S8, it is ranked up according to the caching value coefficients of each first cache resources;
S9, minimum the first cache resources of one or more of caching value coefficient value are replaced with to the second caching money to be cached
Source.
2. a kind of information cache method of replacing according to claim 1, which is characterized in that the step S2 is specifically included:
According to the resource type parameter, resource type set corresponding with first cache resources is determined, and described in determination
The resource temperature impact factor and resource type temperature of resource group, and according to the resource temperature impact factor and resource type heat
Degree, by preset type of value coefficient formulas, obtains the type of value coefficient of the resource type set, wherein institute
State type of value coefficient formulas specifically:
In formula, TiIndicate the type of value coefficient of i-th of resource type set, λiIndicate the i-th class resource resource temperature influence because
Son, PiIt is positively correlated for the resource type temperature and with the resource temperature impact factor, SiFor in preset time interval
The request number of times of the resource type set, S are total request number of times in preset time interval.
3. a kind of information cache method of replacing according to claim 1, which is characterized in that the step S3 is specifically included:
According to the resource size information and preset resource transmission cost parameter, calculated by preset request cost coefficient public
Formula obtains the request cost coefficient of first cache resources, wherein the request cost coefficient calculation formula specifically:
H=Hops*Pr+fileSize;
In formula, H is the request cost coefficient, and Hops is network hops needed for transmission, PrJoin for the required transmission cost of single-hop
Number, fileSize are the resource size information.
4. a kind of information cache method of replacing according to claim 1, which is characterized in that the step S5 is specifically included:
According to the information of cache-time for the first time, the resource expired time information and the current time information, by pre-
The caching validity period accounting coefficient of first cache resources is calculated in the caching validity period accounting coefficient formulas set,
Wherein, the caching validity period accounting coefficient formulas specifically:
In formula, E is the caching validity period accounting coefficient, and expireTime is the resource expired time information, and nowTime is
The current time information, cacheTime are the cache-time information for the first time.
5. a kind of information cache method of replacing according to claim 1, which is characterized in that the step S6 is specifically included:
It is accounted for according to the type of value coefficient and the request cost coefficient, request time interval coefficient, the caching validity period
The corresponding caching value coefficient of first cache resources is obtained by preset caching value coefficient calculation formula than coefficient,
Wherein, the caching value coefficient calculation formula specifically:
Vj=Ti*(1/Ij*Hj*Ej),j∈i;
In formula, VjFor the caching value coefficient of j-th of first cache resources.
6. a kind of information cache method of replacing according to claim 1, which is characterized in that the step S9 is specifically included:
S91, according to the first cache resources after sequence, remove the first minimum cache resources of caching value coefficient;
The total resources size information of S92, removed first cache resources of statistics, if residual memory space is not less than to be cached
The resource size information of second cache resources, thens follow the steps S93, if it is not, then return step S91;
S93, deposit second cache resources.
7. a kind of information cache method of replacing according to claim 1, which is characterized in that the parameter information further include:
Personal secrets are related to type information;
After the step S8 further include:
S81, identical first cache resources of caching value coefficient are judged whether there is, if so, S82 is thened follow the steps, if otherwise
Execute step S9;
Step S82, the replacement priority for relating to hidden first cache resources is set as relating on hidden first cache resources non-, wherein institute
Stating and relating to hidden first cache resources is the first cache resources that personal secrets are related to that type information is yes, it is described it is non-relate to it is hidden first caching
Resource is the first cache resources that personal secrets are related to that type information is no.
8. a kind of information cache displacement apparatus characterized by comprising
First cache resources parameter acquiring unit, for extracting the first caching money according to stored first cache resources
The parameter information in source, wherein the parameter information include resource type information, resource size information, latest requests temporal information,
Cache-time information and resource expired time information for the first time;
Type of value coefficient calculation unit, for according to the resource type parameter, determination to be corresponding with first cache resources
Resource type set, and determine the resource temperature impact factor and resource type temperature of the resource group, and according to the money
The type of value coefficient of the resource type set is calculated, wherein described in source temperature impact factor and resource type temperature
Resource temperature impact factor is specially the request number of times of the resource type set and total request time in preset time interval
Several ratio, the resource type temperature are the parameter being positively correlated with the resource temperature impact factor;
Request cost coefficient computing unit, for according to the resource size information and preset resource transmission cost parameter it
With obtain the request cost coefficient of first cache resources;
Request time interval coefficient computing unit, for the difference according to the latest requests temporal information and current time information
Value, obtains the request time interval coefficient of first cache resources;
Validity period accounting coefficient calculation unit is cached, for according to the cache-time information, the resource expired time for the first time
The caching validity period accounting coefficient of first cache resources is calculated in information and the current time information;
Value coefficient computing unit is cached, according to the type of value coefficient and the request cost coefficient, request time interval
The ratio of coefficient, the caching validity period accounting coefficient, obtains the corresponding caching value coefficient of first cache resources;
Resource sequencing unit, for being ranked up according to the caching value coefficient of each first cache resources;
Resource replacement unit is replaced with for that will cache minimum the first cache resources of one or more of value coefficient value wait cache
The second cache resources.
9. a kind of terminal device characterized by comprising memory and processor;
The memory is for storing journey corresponding with information cache method of replacing as described in any one of claim 1 to 7
Sequence code;
The processor is for executing said program code.
10. a kind of storage medium, which is characterized in that be stored in the storage medium and as described in any one of claim 1 to 7
The corresponding program code of information cache method of replacing.
Priority Applications (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910866387.1A CN110519394B (en) | 2019-09-12 | 2019-09-12 | Information cache replacement method, device, terminal and storage medium |
Applications Claiming Priority (1)
Application Number | Priority Date | Filing Date | Title |
---|---|---|---|
CN201910866387.1A CN110519394B (en) | 2019-09-12 | 2019-09-12 | Information cache replacement method, device, terminal and storage medium |
Publications (2)
Publication Number | Publication Date |
---|---|
CN110519394A true CN110519394A (en) | 2019-11-29 |
CN110519394B CN110519394B (en) | 2022-02-15 |
Family
ID=68632281
Family Applications (1)
Application Number | Title | Priority Date | Filing Date |
---|---|---|---|
CN201910866387.1A Active CN110519394B (en) | 2019-09-12 | 2019-09-12 | Information cache replacement method, device, terminal and storage medium |
Country Status (1)
Country | Link |
---|---|
CN (1) | CN110519394B (en) |
Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120158815A1 (en) * | 2010-11-01 | 2012-06-21 | Kelly Thomas J | System and method for identifying web objects unworthy of being cached |
CN107911711A (en) * | 2017-10-24 | 2018-04-13 | 北京邮电大学 | A kind of edge cache for considering subregion replaces improved method |
CN108650306A (en) * | 2018-04-23 | 2018-10-12 | 何世容 | A kind of game video caching method, device and computer storage media |
CN108900570A (en) * | 2018-05-30 | 2018-11-27 | 南京邮电大学 | A kind of buffer replacing method based on content value |
-
2019
- 2019-09-12 CN CN201910866387.1A patent/CN110519394B/en active Active
Patent Citations (4)
Publication number | Priority date | Publication date | Assignee | Title |
---|---|---|---|---|
US20120158815A1 (en) * | 2010-11-01 | 2012-06-21 | Kelly Thomas J | System and method for identifying web objects unworthy of being cached |
CN107911711A (en) * | 2017-10-24 | 2018-04-13 | 北京邮电大学 | A kind of edge cache for considering subregion replaces improved method |
CN108650306A (en) * | 2018-04-23 | 2018-10-12 | 何世容 | A kind of game video caching method, device and computer storage media |
CN108900570A (en) * | 2018-05-30 | 2018-11-27 | 南京邮电大学 | A kind of buffer replacing method based on content value |
Non-Patent Citations (2)
Title |
---|
王准 等: "基于混合价值计算的云存储缓存替换方案", 《计算机工程与设计》 * |
黄丹 等: "基于内容价值的缓存替换策略", 《电信科学》 * |
Also Published As
Publication number | Publication date |
---|---|
CN110519394B (en) | 2022-02-15 |
Similar Documents
Publication | Publication Date | Title |
---|---|---|
CN109472596B (en) | Alliance's chain common recognition method and system based on transaction assessment | |
CN106020715B (en) | Storage pool capacity management | |
CN104504003B (en) | The searching method and device of diagram data | |
CN105426375B (en) | A kind of calculation method and device of relational network | |
CN105808339B (en) | Big data parallel calculating method and device | |
CN104918214B (en) | A kind of secret protection quantitative analysis method in location-based service | |
CN109194707A (en) | The method and device of distribution figure insertion | |
CN106503007B (en) | Database operation method and device | |
CN107895038A (en) | A kind of link prediction relation recommends method and device | |
CN105243124A (en) | Resource combination processing method and apparatus | |
CN107391600A (en) | Method and apparatus for accessing time series data in internal memory | |
WO2022057310A1 (en) | Method, apparatus and system for training graph neural network | |
Bistaffa et al. | Recommending fair payments for large-scale social ridesharing | |
Frances et al. | Improving the efficiency of multi-site web search engines | |
Cassell et al. | EGTAOnline: An experiment manager for simulation-based game studies | |
CN109739646A (en) | A kind of data processing method and device | |
CN113836318A (en) | Dynamic knowledge graph completion method and device and electronic equipment | |
CN103034678A (en) | RkNN (reverse k nearest neighbor) inquiring method based on Voronoi diagram | |
CN116614385A (en) | Service scheduling path planning method, device and equipment based on digital twin | |
CN106681830B (en) | A kind of task buffer space monitoring method and apparatus | |
CN103957537B (en) | Frequency spectrum sensing method and device based on channel cluster | |
Awad et al. | Multi-objectives model to process security risk assessment based on AHP-PSO | |
CN111626311B (en) | Heterogeneous graph data processing method and device | |
CN108173958A (en) | Data-optimized storage method based on ant group algorithm under a kind of cloudy environment | |
CN112541037B (en) | Spatial crowdsourcing method and terminal based on block chain and deep reinforcement learning |
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 |