CN110489063B - Method and device for setting cache expiration time, electronic equipment and storage medium - Google Patents

Method and device for setting cache expiration time, electronic equipment and storage medium Download PDF

Info

Publication number
CN110489063B
CN110489063B CN201910795199.4A CN201910795199A CN110489063B CN 110489063 B CN110489063 B CN 110489063B CN 201910795199 A CN201910795199 A CN 201910795199A CN 110489063 B CN110489063 B CN 110489063B
Authority
CN
China
Prior art keywords
type
time
setting
data
cache
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
CN201910795199.4A
Other languages
Chinese (zh)
Other versions
CN110489063A (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 QIYI Century Science and Technology Co Ltd
Original Assignee
Beijing QIYI Century Science and Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing QIYI Century Science and Technology Co Ltd filed Critical Beijing QIYI Century Science and Technology Co Ltd
Priority to CN201910795199.4A priority Critical patent/CN110489063B/en
Publication of CN110489063A publication Critical patent/CN110489063A/en
Application granted granted Critical
Publication of CN110489063B publication Critical patent/CN110489063B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0602Interfaces specially adapted for storage systems specifically adapted to achieve a particular effect
    • G06F3/0608Saving storage space on storage systems
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0628Interfaces specially adapted for storage systems making use of a particular technique
    • G06F3/0655Vertical data movement, i.e. input-output transfer; data movement between one or more hosts and one or more storage devices
    • G06F3/0656Data buffering arrangements
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F3/00Input arrangements for transferring data to be processed into a form capable of being handled by the computer; Output arrangements for transferring data from processing unit to output unit, e.g. interface arrangements
    • G06F3/06Digital input from, or digital output to, record carriers, e.g. RAID, emulated record carriers or networked record carriers
    • G06F3/0601Interfaces specially adapted for storage systems
    • G06F3/0668Interfaces specially adapted for storage systems adopting a particular infrastructure
    • G06F3/0671In-line storage system
    • G06F3/0673Single storage device
    • YGENERAL TAGGING OF NEW TECHNOLOGICAL DEVELOPMENTS; GENERAL TAGGING OF CROSS-SECTIONAL TECHNOLOGIES SPANNING OVER SEVERAL SECTIONS OF THE IPC; TECHNICAL SUBJECTS COVERED BY FORMER USPC CROSS-REFERENCE ART COLLECTIONS [XRACs] AND DIGESTS
    • Y02TECHNOLOGIES OR APPLICATIONS FOR MITIGATION OR ADAPTATION AGAINST CLIMATE CHANGE
    • Y02DCLIMATE CHANGE MITIGATION TECHNOLOGIES IN INFORMATION AND COMMUNICATION TECHNOLOGIES [ICT], I.E. INFORMATION AND COMMUNICATION TECHNOLOGIES AIMING AT THE REDUCTION OF THEIR OWN ENERGY USE
    • Y02D10/00Energy efficient computing, e.g. low power processors, power management or thermal management

Landscapes

  • Engineering & Computer Science (AREA)
  • Theoretical Computer Science (AREA)
  • Human Computer Interaction (AREA)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Memory System Of A Hierarchy Structure (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the application provides a setting method, a setting device, an electronic device and a storage medium for cache expiration time, wherein a first access amount of first type data stored in the electronic device and a cache hit rate corresponding to the first access amount can be obtained in a first preset time period; determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate; and setting the buffer expiration time of the first type of target data according to the read times. According to the method and the device, the buffer expiration time can be set through the number of times that the data is read in the permanent memory, so that the buffer expiration time is matched with the number of times that the data is read in the permanent memory, fine management of the buffer data is achieved, the reading pressure of the permanent memory is reduced, and the buffer space is saved.

Description

Method and device for setting cache expiration time, electronic equipment and storage medium
Technical Field
The present invention relates to the field of data caching, and in particular, to a method and apparatus for setting a cache expiration time, an electronic device, and a storage medium.
Background
A permanent memory such as a hard disk can store a large amount of data, but the speed of reading data from the permanent memory is relatively slow. In order to increase the data reading speed, the prior art stores part of data by a cache capable of performing high-speed data reading and writing. When certain data needs to be read, the data is firstly tried to be read in a cache, and if the data is not read, the data is read from the permanent memory. Because the storage space of the cache is small, data which is not read for a long time needs to be deleted from the cache in time so as to store other data. Existing caches manage data stored in the cache by setting a cache expiration time (e.g., 1 minute), and when some data is not read within the cache expiration time, the data is deleted from the cache.
The existing buffer expiration time is generally set by a technician according to experience and is applied to the whole buffer, and the buffer expiration time of all data in the buffer is the same. However, access information such as access amounts of different data in the cache is different, so that the unified cache expiration time is not beneficial to fine management of the cache data, so that a large amount of data which is not frequently accessed is stored in the cache, and the cache space is wasted.
Disclosure of Invention
In view of the foregoing, the present application provides a method, an apparatus, an electronic device, and a storage medium for setting a buffer expiration time, so as to implement fine management of buffered data.
In order to achieve the above object, the present application provides a method for setting a buffer expiration time, which is applied to an electronic device, where the electronic device includes: a persistent memory and a cache, the persistent memory having a first type of data stored therein, the method comprising:
obtaining a first access amount of first type data stored in the electronic equipment and a cache hit rate corresponding to the first access amount within a first preset time period;
determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate;
and setting the buffer expiration time of the first type of target data according to the read times.
Optionally, the setting the buffer expiration time of the first type of target data according to the read times includes:
and setting the buffer expiration time of the first type of data put into the buffer in a second preset time period to be a time length matched with the read times.
Optionally, the setting the buffer expiration time of the first type of target data according to the read times includes:
determining a frequency interval in which the read frequency is located;
and setting the buffer expiration time of the first type of target data to be a duration matched with the determined time interval.
Optionally, the setting the buffer expiration time of the first type of target data to a duration that matches the determined number of times interval includes:
setting the buffer expiration time of the first type of target data to a first duration corresponding to a first time interval when the read times are located in the first time interval;
when the read times are in a second time interval, setting the buffer expiration time of the first type of target data to be a second time length corresponding to the second time interval, wherein any times in the first time interval are larger than any times in the second time interval, and the first time length is longer than the second time length.
Optionally, the determining, according to the first access amount and the cache hit rate, the number of times that the first type of data is read in the persistent memory in the first preset period of time includes:
according to the formula
N=M(1-R)
And calculating the number of times N of reading the first type of data in the permanent memory storage in the first preset time period, wherein M is the first access quantity, and R is the cache hit rate.
Optionally, the method further comprises:
obtaining a second access amount to the first type of data stored in the electronic device within a third preset time period, wherein the third preset time period is different from the first preset time period;
and determining the buffer expiration time of the first type of target data according to the second access amount.
In order to achieve the above object, the present application further provides a device for setting a buffer expiration time, which is applied to an electronic device, where the electronic device includes: a persistent memory and a cache, the persistent memory having a first type of data stored therein, the apparatus comprising: an information obtaining unit, a number determining unit and a time setting unit,
the information obtaining unit is used for obtaining a first access amount of the first type of data stored in the electronic equipment and a cache hit rate corresponding to the first access amount in a first preset time period;
the number determining unit is used for determining the number of times that the first type of data is read in the permanent memory storage in the first preset time period according to the first access amount and the cache hit rate;
the time setting unit is used for setting the buffer expiration time of the first type of target data according to the read times.
Optionally, the time setting unit is specifically configured to: and setting the buffer expiration time of the first type of data put into the buffer in a second preset time period to be a time length matched with the read times.
To achieve the above object, the present application further provides an electronic device, including: the system comprises a processor, a permanent memory storage and a cache, wherein the permanent memory storage stores data of a first type, the permanent memory storage and/or the cache stores a cache expiration time setting program which can be run on the processor, and the cache expiration time setting program realizes any one of the cache expiration time setting methods when being executed by the processor.
In order to achieve the above object, the present application further provides a storage medium, where a program for setting a buffer expiration time is stored, where the program for setting a buffer expiration time may be executed by one or more processors, so as to implement any one of the methods for setting a buffer expiration time described above.
According to the setting method, the setting device, the electronic equipment and the storage medium of the cache expiration time, a first access amount of first type data stored in the electronic equipment in a first preset time period and a cache hit rate corresponding to the first access amount can be obtained; determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate; and setting the buffer expiration time of the first type of target data according to the read times. According to the method and the device, the buffer expiration time can be set through the number of times that the data is read in the permanent memory, so that the buffer expiration time is matched with the number of times that the data is read in the permanent memory, fine management of the buffer data is achieved, the reading pressure of the permanent memory is reduced, and the buffer space is saved.
Drawings
In order to more clearly illustrate the embodiments of the present application or the technical solutions in the prior art, the drawings used in the description of the embodiments or the prior art will be briefly described below.
Fig. 1 is a flowchart of a method for setting a buffer expiration time according to an embodiment of the present application;
FIG. 2 is a flowchart of another method for setting a buffer expiration time according to an embodiment of the present application;
fig. 3 is a schematic structural diagram of a device for setting a buffer expiration time according to an embodiment of the present application;
fig. 4 is a schematic structural diagram of an electronic device according to an embodiment of the present application.
Detailed Description
In order to make the objects, technical solutions and advantages of the present application more apparent, the present application will be further described in detail with reference to the accompanying drawings and examples. It should be understood that the specific embodiments described herein are for purposes of illustration only and are not intended to limit the present application. All other embodiments, which can be made by one of ordinary skill in the art without undue burden from the present disclosure, are within the scope of the present disclosure.
The terms "first," "second," "third," "fourth" and the like in the description and in the claims of this application and in the above-described figures, if any, are used for distinguishing between similar objects and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used may be interchanged where appropriate such that the embodiments described herein may be implemented in other sequences than those illustrated or otherwise described herein. Furthermore, the terms "comprises," "comprising," and "having," and any variations thereof, are intended to cover a non-exclusive inclusion, such that a process, method, system, article, or apparatus that comprises a list of steps or elements is not necessarily limited to those steps or elements expressly listed but may include other steps or elements not expressly listed or inherent to such process, method, article, or apparatus.
It should be noted that the description herein of "first," "second," etc. is for descriptive purposes only and is not to be construed as indicating or implying a relative importance or implying an indication of the number of technical features being indicated. Thus, a feature defining "a first" or "a second" may explicitly or implicitly include at least one such feature. In addition, the technical solutions of the embodiments may be combined with each other, but it is necessary to base that the technical solutions can be realized by those skilled in the art, and when the technical solutions are contradictory or cannot be realized, the combination of the technical solutions should be regarded as not exist and not within the protection scope of the present application.
The method for setting the expiration time of the cache, provided by the embodiment of the application, can be applied to electronic equipment, and the electronic equipment comprises: a persistent memory and a cache, the persistent memory having a first type of data stored therein, as shown in fig. 1, the method may include:
s100, obtaining a first access amount of first type data stored in the electronic equipment and a cache hit rate corresponding to the first access amount in a first preset time period;
the method and the device can divide the preset time length into a plurality of time periods, and the first preset time period can be one of the time periods. Specifically, the first preset time period may be a time period before the current time. For example: the preset duration is 10 minutes, and the time after the time is divided into a plurality of time periods with the duration of 10 minutes from 00 minutes and 00 seconds at the time of a certain month of a certain year, and the time periods are sequentially adjacent according to the time sequence. The method of fig. 1 of the present application may be performed once after a time has elapsed.
In a specific embodiment, the first preset time period may be a time period before the current time, such as 10 minutes before the current time. Step S100 may obtain a first access amount to the first type of data stored in the electronic device and a cache hit rate corresponding to the first access amount within the first 10 minutes of the current time.
The electronic device may be a server, a computer, a mobile phone, an intelligent wearable device, or the like.
Specifically, whether or not the first type of data is stored in the cache, when a certain data access party reads the first type of data from the electronic device, the access amount of the first type of data is increased by 1.
The cache hit rate is the probability that the data access party reads the data from the cache to be read, for example: for the first type of data, the cache hit rate is the number of times each data access party reads the first type of data from the cache and the number of times each data access party reads the first type of data from the electronic device. Assuming that the 500 data access parties read the first type of data in the electronic device 10000 times, and 3000 times of the 10000 times of the reads are from the cache to the first type of data, the cache hit rate of the first type of data is 3000/10000=30%. Namely: when a certain data access party reads the first type of data from the electronic device, there is a 30% probability that the first type of data is read from the cache.
S200, determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate;
the step S200 may specifically include:
according to the formula
N=M(1-R)
And calculating the number of times N of reading the first type of data in the permanent memory storage in the first preset time period, wherein M is the first access quantity, and R is the cache hit rate.
S300, setting the buffer expiration time of the first type of target data according to the read times.
In one embodiment, the target data may refer to data stored in the cache in a next time period.
The step S300 may specifically include:
and setting the buffer expiration time of the first type of data put into the buffer in a second preset time period to be a time length matched with the read times.
In a specific embodiment, the second preset time period is a time period after the first preset time period, and of course, the second preset time period may be adjacent to or not adjacent to the first preset time period. According to the method and the device, according to the number of times that the first type of data is read in the permanent memory storage in the first preset time period, the cache expiration time of the first type of data placed in the cache in the second preset time period is set to be the time length matched with the number of times that the first type of data is read. It can be seen that the present application sets the cache expiration time for the first type of data placed in the cache during the subsequent time period by the number of times the data was read in the persistent memory during the previous time period.
The step S300 may specifically include:
determining a frequency interval in which the read frequency is located;
and setting the buffer expiration time of the first type of target data to be a duration matched with the determined time interval.
Specifically, at least two time intervals may be set in the present application, each time interval corresponds to a buffer expiration time, and the buffer expiration time corresponding to each time interval may be different. Those skilled in the art can set and modify the number of times interval and the buffer expiration time corresponding to the number of times interval according to actual needs, and the application does not limit each number of times interval and the buffer expiration time corresponding to each time interval.
Optionally, no intersection exists between the frequency intervals. The frequency intervals can be sequentially arranged in order from smaller to larger, and the upper limit of the former frequency interval and the lower limit of the latter frequency interval in the two adjacent frequency intervals after arrangement are the same value. For example: the upper limit 50 of the time interval (0, 50) and the lower limit 50 of the time interval (50, 100) are the same value for the time interval (0, 50) and the time interval (50, 100).
Of course, since the number of times is generally a natural number, the upper limit of the preceding time interval and the lower limit of the following time interval of the two adjacent time intervals are adjacent natural numbers. Such as: the number of intervals (0, 50) and the number of intervals [51,100], the upper limit 50 of the number of intervals (0, 50) and the lower limit 51 of the number of intervals [51,100] are adjacent natural numbers.
It should be noted that, the more times the first type of data is read in the persistent memory, the greater the reading pressure of the first type of data on the persistent memory is, so the buffer expiration time of the first type of data can be increased, so that the first type of data is kept in the buffer for a longer time, and the reading pressure of the first type of data on the persistent memory is reduced. Conversely, when the number of times the first type of data is read in the persistent memory is small, the read pressure of the first type of data on the persistent memory is small, and in this case, the first type of data may be caused by a small access amount, or may be caused by a high cache hit rate. When the access amount to the first type of data is smaller, the method and the device can reduce the buffer expiration time of the first type of data, so that the buffer space is saved, the saved buffer space is used for storing other data with higher access amount, and the buffer utilization rate is improved. When the cache hit rate is higher, it indicates that the cache expiration time of the first type of data is longer, or the number of times of reading the first type of data from the cache is greater, and in either case, the cache expiration time of the first type of data can be correspondingly reduced.
The setting the buffer expiration time of the first type of target data to be a duration matched with the determined time interval comprises the following steps:
setting the buffer expiration time of the first type of target data to a first duration corresponding to a first time interval when the read times are located in the first time interval;
when the read times are in a second time interval, setting the buffer expiration time of the first type of target data to be a second time length corresponding to the second time interval, wherein any times in the first time interval are larger than any times in the second time interval, and the first time length is longer than the second time length.
The number of time intervals can be obtained by dividing, corresponding time lengths are set for the number of time intervals, and table 1 shows a corresponding relationship between the number of time intervals and the time lengths.
Table 1 correspondence between time intervals and time durations
Level of Number of intervals Cache expiration time
1 (0,10] 30 minutes
2 [11,100] 1 hour
3 [101,200] 3 hours
4 [201,500] For 6 hours
5 [501,1000] For 12 hours
6 [1001,2000] For 1 day
7 [2001,5000] For 4 days
8 [5001,8000] For 7 days
9 [8001,10000] For 10 days
10 [10001,+∞] For 30 days
According to the setting method of the buffer expiration time, a first access amount of the first type of data stored in the electronic equipment and a buffer hit rate corresponding to the first access amount can be obtained in a first preset time period; determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate; and setting the buffer expiration time of the first type of target data according to the read times. According to the method and the device, the buffer expiration time can be set through the number of times that the data is read in the permanent memory, so that the buffer expiration time is matched with the number of times that the data is read in the permanent memory, fine management of the buffer data is achieved, the reading pressure of the permanent memory is reduced, and the buffer space is saved.
As shown in fig. 2, another method for setting a buffer expiration time according to the embodiment of the present application may further include, based on the embodiment shown in fig. 1:
s001, obtaining a second access amount of the first type of data stored in the electronic equipment in a third preset time period, wherein the third preset time period is different from the first preset time period;
wherein the third preset time period may be earlier than the first preset time period.
S002, determining the buffer expiration time of the first type of target data according to the second access amount;
specifically, step S002 may specifically include:
determining the ranking of the second access amount in the access amount ranking of the target data of each type in a preset type group, wherein the preset type group comprises a first type;
and determining the buffer expiration time of the first type of target data according to the ranking.
Specifically, the buffer expiration time determined according to the ranking in the present application may be an initial buffer expiration time. Alternatively, as shown in fig. 2, steps S001 and S002 may be first performed to determine an initial cache expiration time prior to performing the method of fig. 1 of the present application. The method of fig. 1 of the present application is then performed to modify the initial cache expiration time. Of course, step S001 and step S002 may be performed after the steps shown in fig. 1 are performed, which is not limited herein.
Specifically, the present application may determine the data type from a key prefix of the data, for example: the key of the user information in the cache is user_info_xxx, the key prefix of the user information is user_info, and xxx is the unique identifier (uid) of the user. The present application can thus identify each data belonging to this type of user information by means of the user_info. Specifically, after determining the type of each data, the application can count the access amount of each data according to the type.
Specifically, for N types of data with the highest access amount, the present application may determine the initial buffer expiration time of the N types of data as a duration in the third duration interval, and for other types of data except for the N types of data, the present application may determine the initial buffer expiration time of the N types of data as a duration in the fourth duration interval, where any duration in the fourth duration interval is smaller than any duration in the third duration interval.
Of course, in practical application, the initial buffer expiration time of the hotspot data selected by the user may also be determined as a duration in a fifth duration interval, where any duration in the fifth duration interval is greater than any duration in the third duration interval. Wherein the hotspot data may be defined and modified by the user.
Corresponding to the embodiment of the method, the embodiment of the application also provides a device for setting the expiration time of the cache. As shown in fig. 3, the apparatus may be applied to an electronic device, and the electronic device may include: a persistent memory, in which a first type of data is stored, and a cache, the apparatus may include: an information obtaining unit 100, a number determining unit 200 and a time setting unit 300,
the information obtaining unit 100 is configured to obtain a first access amount of a first type of data stored in the electronic device and a cache hit rate corresponding to the first access amount in a first preset period of time;
the number determining unit 200 is configured to determine, according to the first access amount and the cache hit rate, the number of times that the first type of data is read in the persistent memory within the first preset period;
in a specific embodiment, the number determining unit 200 may specifically be configured to:
according to the formula
N=M(1-R)
And calculating the number of times N of reading the first type of data in the permanent memory storage in the first preset time period, wherein M is the first access quantity, and R is the cache hit rate.
The time setting unit 300 is configured to set a cache expiration time of the first type of target data according to the read number.
In a specific embodiment, the time setting unit 300 may specifically be configured to: and setting the buffer expiration time of the first type of data put into the buffer in a second preset time period to be a time length matched with the read times.
In one embodiment, the time setting unit 300 may include: an interval determination subunit and a duration setting subunit,
the interval determining subunit is used for determining a frequency interval in which the read frequency is located;
the time length setting subunit is configured to set a buffer expiration time of the first type of target data to a time length that matches the determined frequency interval.
In a specific embodiment, the duration setting subunit may include: a first setting subunit and a second setting subunit,
the first setting subunit is configured to set, when the read number of times is in a first time interval, a buffer expiration time of the first type of target data to a first duration corresponding to the first time interval;
the second setting subunit is configured to set, when the read number of times is located in a second number of times interval, a buffer expiration time of the first type of target data to a second duration corresponding to the second number of times interval, where any number of times in the first number of times interval is greater than any number of times in the second number of times interval, and the first duration is greater than the second duration.
In a specific embodiment, the apparatus shown in fig. 3 may further include: an access amount obtaining unit and an expiration determining unit,
the access amount obtaining unit is configured to obtain a second access amount to the first type of data stored in the electronic device in a third preset time period, where the third preset time period is different from the first preset time period;
and the expiration determining unit is used for determining the cache expiration time of the first type of target data according to the second access quantity.
The setting device of the buffer expiration time provided by the embodiment of the application can obtain a first access amount of the first type of data stored in the electronic equipment and a buffer hit rate corresponding to the first access amount in a first preset time period; determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate; and setting the buffer expiration time of the first type of target data according to the read times. According to the method and the device, the buffer expiration time can be set through the number of times that the data is read in the permanent memory, so that the buffer expiration time is matched with the number of times that the data is read in the permanent memory, fine management of the buffer data is achieved, the reading pressure of the permanent memory is reduced, and the buffer space is saved.
As shown in fig. 4, the embodiment of the present application further provides an electronic device 10, where the electronic device 10 may include: the method comprises the steps of a processor 12, a permanent memory storage 13 and a cache 11, wherein the permanent memory storage 13 stores data of a first type, the permanent memory storage 13 and/or the cache 11 stores a setting program of a cache expiration time which can run on the processor 12, and the setting program of the cache expiration time realizes any of the setting methods of the cache expiration time provided by the embodiments of the present application when being executed by the processor 12.
The cache 11 may be, but is not limited to, a read-Only Memory (ROM) or other type of static storage device that can store static information and instructions, a random access Memory (random access Memory, RAM) or other type of dynamic storage device that can store information and instructions, or an electrically erasable programmable read-Only Memory (Electrically Erasable Programmable Read-Only Memory, EEPROM), a magnetic disk storage medium or other magnetic storage device, or any other medium that can be used to carry or store desired program code in the form of instructions or data structures and that can be accessed by a computer. The cache 11 may be independent or may be integrated with the processor 12.
The permanent memory storage 13 includes at least one type of readable storage medium including flash memory, a hard disk, a multimedia card, a card type memory (e.g., SD or DX memory, etc.), a magnetic memory, a magnetic disk, an optical disk, etc. The permanent memory storage 13 may in some embodiments be an internal storage unit of the electronic device 10, such as a hard disk of the electronic device 10. The permanent memory 13 may in other embodiments also be an external storage device of the electronic device 10, such as a plug-in hard disk, a Smart Media Card (SMC), a Secure Digital (SD) Card, a Flash Card (Flash Card) or the like, which are provided on the electronic device 10. Further, the permanent memory storage 13 may also include both internal storage units and external storage devices of the electronic device 10. The permanent memory storage 13 may be used not only for storing application software installed in the electronic device 10 and various types of data, such as codes of a setting program for buffering expiration time, etc., but also for temporarily storing data that has been output or is to be output.
The processor 12 may in some embodiments be a central processing unit (Central Processing Unit, CPU), controller, microcontroller, microprocessor or other data processing chip for running program code or processing data stored in the memory 12, such as executing a cache expiration time setting program or the like.
Further, the electronic device 10 may further include a bus, which may be a peripheral component interconnect standard (peripheral component interconnect, abbreviated as PCI) bus or an extended industry standard architecture (extended industry standard architecture, abbreviated as EISA) bus, or the like. The bus may be classified as an address bus, a data bus, a control bus, etc.
Further, the electronic device 10 may also comprise a network interface, which may optionally comprise a wired interface and/or a wireless interface (e.g. WI-FI interface, bluetooth interface, etc.), typically used to establish a communication connection between the apparatus 1 and other electronic devices.
Optionally, the electronic device 10 may further comprise a user interface, which may comprise a Display (Display), an input unit such as a Keyboard (Keyboard), and a standard wired interface, a wireless interface. Alternatively, in some embodiments, the display may be an LED display, a liquid crystal display, a touch-sensitive liquid crystal display, an OLED (Organic Light-Emitting Diode) touch, or the like. The display may also be referred to as a display screen or display unit, as appropriate, for displaying information processed in the electronic device 10 and for displaying a visual user interface.
Fig. 4 shows only an electronic device 10 having components 11-13, it will be understood by those skilled in the art that the configuration shown in fig. 4 is not limiting of the electronic device 10 and may include fewer or more components than shown, or may combine certain components, or a different arrangement of components.
The embodiment of the application also provides a storage medium, wherein the storage medium is stored with a program for setting the buffer expiration time, and the program for setting the buffer expiration time can be executed by one or more processors so as to realize any method for setting the buffer expiration time. The storage medium may be a computer readable storage medium.
In the above embodiments, it may be implemented in whole or in part by software, hardware, firmware, or any combination thereof. When implemented in software, may be implemented in whole or in part in the form of a computer program product.
The computer program product includes one or more computer instructions. When loaded and executed on a computer, produces a flow or function in accordance with embodiments of the present application, in whole or in part. The computer may be a general purpose computer, a special purpose computer, a computer network, or other programmable apparatus. The computer instructions may be stored in a computer-readable storage medium or transmitted from one computer-readable storage medium to another computer-readable storage medium, for example, the computer instructions may be transmitted from one website, computer, server, or data center to another website, computer, server, or data center by a wired (e.g., coaxial cable, fiber optic, digital Subscriber Line (DSL)) or wireless (e.g., infrared, wireless, microwave, etc.). The computer readable storage medium may be any available medium that can be stored by a computer or a data storage device such as a server, data center, etc. that contains an integration of one or more available media. The usable medium may be a magnetic medium (e.g., floppy Disk, hard Disk, magnetic tape), an optical medium (e.g., DVD), or a semiconductor medium (e.g., solid State Disk (SSD)), etc.
It will be clear to those skilled in the art that, for convenience and brevity of description, specific working procedures of the above-described systems, apparatuses and units may refer to corresponding procedures in the foregoing method embodiments, which are not repeated herein.
In the several embodiments provided in this application, it should be understood that the disclosed systems, apparatuses, and methods may be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative, e.g., the division of the units is merely a logical function division, and there may be additional divisions when actually implemented, e.g., multiple units or components may be combined or integrated into another system, or some features may be omitted or not performed. Alternatively, the coupling or direct coupling or communication connection shown or discussed with each other may be an indirect coupling or communication connection via some interfaces, devices or units, which may be in electrical, mechanical or other form.
The units described as separate units may or may not be physically separate, and units shown as units may or may not be physical units, may be located in one place, or may be distributed on a plurality of network units. Some or all of the units may be selected according to actual needs to achieve the purpose of the solution of this embodiment.
In addition, each functional unit in each embodiment of the present application may be integrated in one processing unit, or each unit may exist alone physically, or two or more units may be integrated in one unit. The integrated units may be implemented in hardware or in software functional units.
The integrated units, if implemented in the form of software functional units and sold or used as stand-alone products, may be stored in a computer readable storage medium. Based on such understanding, the technical solution of the present application may be embodied in essence or a part contributing to the prior art or all or part of the technical solution in the form of a software product stored in a storage medium, including several instructions to cause a computer device (which may be a personal computer, a server, or a network device, etc.) to perform all or part of the steps of the methods described in the embodiments of the present application. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a random access Memory (RAM, random Access Memory), a magnetic disk, or an optical disk, or other various media capable of storing program codes.
It should be noted that, the foregoing embodiment numbers are merely for describing the embodiments, and do not represent the advantages and disadvantages of the embodiments. And the terms "comprises," "comprising," or any other variation thereof, are intended to cover a non-exclusive inclusion, such that a process, apparatus, article, or method that comprises a list of elements does not include only those elements but may include other elements not expressly listed or inherent to such process, apparatus, article, or method. Without further limitation, an element defined by the phrase "comprising one … …" does not exclude the presence of other like elements in a process, apparatus, article or method that comprises the element.
The foregoing description is only of the preferred embodiments of the present application, and is not intended to limit the scope of the claims, and all equivalent structures or equivalent processes using the descriptions and drawings of the present application, or direct or indirect application in other related technical fields are included in the scope of the claims of the present application.

Claims (8)

1. The setting method of the buffer expiration time is characterized by being applied to electronic equipment, and the electronic equipment comprises the following steps: a persistent memory and a cache, the persistent memory having a first type of data stored therein, the method comprising:
obtaining a first access amount of first type data stored in the electronic equipment and a cache hit rate corresponding to the first access amount within a first preset time period;
determining the number of times that the first type of data is read in the permanent memory storage within the first preset time period according to the first access amount and the cache hit rate;
setting the cache expiration time of the first type of target data according to the read times, wherein the more the read times are, the longer the cache expiration time of the first type of target data is set; the fewer the number of times read, the shorter the cache expiration time setting of the first type of target data;
the setting the buffer expiration time of the first type of target data according to the read times includes:
and setting the buffer expiration time of the first type of data put into the buffer in a second preset time period to be a time length matched with the read times.
2. The method of claim 1, wherein setting the cache expiration time of the first type of target data according to the number of times read, further comprises:
determining a frequency interval in which the read frequency is located;
and setting the buffer expiration time of the first type of target data to be a duration matched with the determined time interval.
3. The method of claim 2, wherein the setting the cache expiration time of the first type of target data to a length of time that matches the determined time interval comprises:
setting the buffer expiration time of the first type of target data to a first duration corresponding to a first time interval when the read times are located in the first time interval;
when the read times are in a second time interval, setting the buffer expiration time of the first type of target data to be a second time length corresponding to the second time interval, wherein any times in the first time interval are larger than any times in the second time interval, and the first time length is longer than the second time length.
4. The method of claim 1, wherein the determining the number of times the first type of data is read in the persistent memory within the first preset period of time based on the first access amount and the cache hit rate comprises:
according to the formula
N=M(1-R)
And calculating the number of times N of reading the first type of data in the permanent memory storage in the first preset time period, wherein M is the first access quantity, and R is the cache hit rate.
5. The method according to claim 1, wherein the method further comprises:
obtaining a second access amount to the first type of data stored in the electronic device within a third preset time period, wherein the third preset time period is different from the first preset time period;
and determining the buffer expiration time of the first type of target data according to the second access amount.
6. The setting device of the buffer expiration time is characterized by being applied to electronic equipment, and the electronic equipment comprises: a persistent memory and a cache, the persistent memory having a first type of data stored therein, the apparatus comprising: an information obtaining unit, a number determining unit and a time setting unit,
the information obtaining unit is used for obtaining a first access amount of the first type of data stored in the electronic equipment and a cache hit rate corresponding to the first access amount in a first preset time period;
the number determining unit is used for determining the number of times that the first type of data is read in the permanent memory storage in the first preset time period according to the first access amount and the cache hit rate;
the time setting unit is configured to set a cache expiration time of the first type of target data according to the read times, where the greater the read times, the longer the cache expiration time of the first type of target data is set; the fewer the number of times read, the shorter the cache expiration time setting of the first type of target data;
the time setting unit is specifically configured to: and setting the buffer expiration time of the first type of data put into the buffer in a second preset time period to be a time length matched with the read times.
7. An electronic device, the electronic device comprising: the system comprises a processor, a persistent memory and a cache, wherein the persistent memory stores data of a first type, the persistent memory and/or the cache stores a cache expiration time setting program capable of running on the processor, and the cache expiration time setting program realizes the cache expiration time setting method according to any one of claims 1-5 when being executed by the processor.
8. A storage medium having stored thereon a program for setting a buffer expiration time, the program being executable by one or more processors to implement the method for setting a buffer expiration time as claimed in any one of claims 1 to 5.
CN201910795199.4A 2019-08-27 2019-08-27 Method and device for setting cache expiration time, electronic equipment and storage medium Active CN110489063B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201910795199.4A CN110489063B (en) 2019-08-27 2019-08-27 Method and device for setting cache expiration time, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201910795199.4A CN110489063B (en) 2019-08-27 2019-08-27 Method and device for setting cache expiration time, electronic equipment and storage medium

Publications (2)

Publication Number Publication Date
CN110489063A CN110489063A (en) 2019-11-22
CN110489063B true CN110489063B (en) 2023-12-19

Family

ID=68554481

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201910795199.4A Active CN110489063B (en) 2019-08-27 2019-08-27 Method and device for setting cache expiration time, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN110489063B (en)

Families Citing this family (4)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN111131856B (en) * 2019-12-31 2022-03-11 北京奇艺世纪科技有限公司 Cache expiration time adjusting method and device, electronic equipment and storage medium
CN112035526B (en) * 2020-09-01 2023-09-22 中国银行股份有限公司 Data caching method, device, equipment and readable storage medium
CN115080625B (en) * 2022-07-21 2022-11-04 成都薯片科技有限公司 Caching method, device and equipment based on Spring Cache framework and storage medium
CN115657954B (en) * 2022-11-01 2023-06-20 昆仑数智科技有限责任公司 Data processing method and device

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2016165542A1 (en) * 2015-04-15 2016-10-20 阿里巴巴集团控股有限公司 Method for analyzing cache hit rate, and device
CN106484633A (en) * 2016-10-08 2017-03-08 广州华多网络科技有限公司 A kind of data cached method and device
WO2017045538A1 (en) * 2015-09-14 2017-03-23 阿里巴巴集团控股有限公司 Http-based cache, request and response methods, and corresponding apparatuses
CN106599152A (en) * 2016-12-07 2017-04-26 北京华夏电通科技有限公司 Data caching method and system
CN107301215A (en) * 2017-06-09 2017-10-27 北京奇艺世纪科技有限公司 A kind of search result caching method and device, searching method and device
CN107666509A (en) * 2017-08-28 2018-02-06 深圳市诚壹科技有限公司 Buffer control method and server
CN109190070A (en) * 2018-08-01 2019-01-11 北京奇艺世纪科技有限公司 A kind of data processing method, device, system and application server
US10216631B1 (en) * 2013-09-05 2019-02-26 United Services Automobile Association (Usaa) Revising cache expiration
CN110069419A (en) * 2018-09-04 2019-07-30 中国平安人寿保险股份有限公司 Multilevel cache system and its access control method, equipment and storage medium

Family Cites Families (2)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
WO2017218503A1 (en) * 2016-06-13 2017-12-21 Convida Wireless, Llc System and methods for service layer cache management
US10331381B2 (en) * 2017-02-20 2019-06-25 Tsinghua University Method and device for recording memory access operation information

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US10216631B1 (en) * 2013-09-05 2019-02-26 United Services Automobile Association (Usaa) Revising cache expiration
WO2016165542A1 (en) * 2015-04-15 2016-10-20 阿里巴巴集团控股有限公司 Method for analyzing cache hit rate, and device
WO2017045538A1 (en) * 2015-09-14 2017-03-23 阿里巴巴集团控股有限公司 Http-based cache, request and response methods, and corresponding apparatuses
CN106484633A (en) * 2016-10-08 2017-03-08 广州华多网络科技有限公司 A kind of data cached method and device
CN106599152A (en) * 2016-12-07 2017-04-26 北京华夏电通科技有限公司 Data caching method and system
CN107301215A (en) * 2017-06-09 2017-10-27 北京奇艺世纪科技有限公司 A kind of search result caching method and device, searching method and device
CN107666509A (en) * 2017-08-28 2018-02-06 深圳市诚壹科技有限公司 Buffer control method and server
CN109190070A (en) * 2018-08-01 2019-01-11 北京奇艺世纪科技有限公司 A kind of data processing method, device, system and application server
CN110069419A (en) * 2018-09-04 2019-07-30 中国平安人寿保险股份有限公司 Multilevel cache system and its access control method, equipment and storage medium

Non-Patent Citations (7)

* Cited by examiner, † Cited by third party
Title
.Net环境下空间数据缓存方案的设计与实现;李滨等;海洋测绘(第03期);全文 *
Cache Replacement Policies;Akanksha Jain等;《MORGAN&CLAYPOOL PUBLISHERS》;20190531;全文 *
ETD-Cache:an expiration-time driven cache scheme to make SSD-based read cache endurable and cost-efficient;Ningwei Dai etc.;ACM Digital Library;全文 *
一种基于DHT的Web缓存共享方法;刘建等;《计算机应用研究》;20081215(第12期);全文 *
基于LRU算法的Web系统缓存机制;张震波等;计算机工程(第19期);全文 *
支持透明集成的数据缓存机制;王彦士等;计算机研究与发展(第04期);全文 *
电子商务网站性能优化;刘佳;《信息与电脑(理论版)》;20171108(第21期);全文 *

Also Published As

Publication number Publication date
CN110489063A (en) 2019-11-22

Similar Documents

Publication Publication Date Title
CN110489063B (en) Method and device for setting cache expiration time, electronic equipment and storage medium
CN106911780B (en) Service ID generation method, device and system
CN105205014B (en) A kind of date storage method and device
CN111400308B (en) Processing method of cache data, electronic device and readable storage medium
US10606806B2 (en) Method and apparatus for storing time series data
CN108984553B (en) Caching method and device
CN107092628B (en) Time series data processing method and device
CN109842621B (en) Method and terminal for reducing token storage quantity
CN109388671B (en) Data processing method, device, equipment and storage medium
CN113486036A (en) Virtual resource management method and device, electronic equipment and storage medium
US10698608B2 (en) Method, apparatus and computer storage medium for data input and output
CN109542945B (en) Block chain data statistical analysis method, device and storage medium
CN109284193B (en) Distributed data processing method based on multithreading and server
CN110955639A (en) Data processing method and device
CN115617255A (en) Management method and management device for cache files
CN110648032A (en) Information updating method and device
CN110689333B (en) Block chain automatic account checking method, device, system and storage medium
CN110321298B (en) Time interval determination method and device, electronic equipment and medium
CN111913913A (en) Access request processing method and device
CN113220705A (en) Slow query identification method and device
US20220156779A1 (en) Method, apparatus, and computer device for calculating website user credit point
CN111737209A (en) File cleaning method and related equipment thereof
CN115617800A (en) Data reading method and device, electronic equipment and storage medium
CN115277588A (en) Fusing current limiting system based on middle platform system
CN110427340B (en) Method, apparatus and computer storage medium for file storage

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