CN114547093A - Cache control method, device, equipment and storage medium - Google Patents

Cache control method, device, equipment and storage medium Download PDF

Info

Publication number
CN114547093A
CN114547093A CN202210006920.9A CN202210006920A CN114547093A CN 114547093 A CN114547093 A CN 114547093A CN 202210006920 A CN202210006920 A CN 202210006920A CN 114547093 A CN114547093 A CN 114547093A
Authority
CN
China
Prior art keywords
data
query
data query
repetition rate
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.)
Pending
Application number
CN202210006920.9A
Other languages
Chinese (zh)
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.)
China Internet Network Information Center
Original Assignee
China Internet Network Information Center
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 China Internet Network Information Center filed Critical China Internet Network Information Center
Priority to CN202210006920.9A priority Critical patent/CN114547093A/en
Publication of CN114547093A publication Critical patent/CN114547093A/en
Pending legal-status Critical Current

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F16/00Information retrieval; Database structures therefor; File system structures therefor
    • G06F16/20Information retrieval; Database structures therefor; File system structures therefor of structured data, e.g. relational data
    • G06F16/24Querying
    • G06F16/245Query processing
    • G06F16/2453Query optimisation
    • G06F16/24534Query rewriting; Transformation
    • G06F16/24539Query rewriting; Transformation using cached or materialised query results
    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06FELECTRIC DIGITAL DATA PROCESSING
    • G06F12/00Accessing, addressing or allocating within memory systems or architectures
    • G06F12/02Addressing or allocation; Relocation
    • G06F12/08Addressing or allocation; Relocation in hierarchically structured memory systems, e.g. virtual memory systems
    • G06F12/0802Addressing of a memory level in which the access to the desired data or data block requires associative addressing means, e.g. caches
    • G06F12/0877Cache access modes
    • 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)
  • Physics & Mathematics (AREA)
  • General Engineering & Computer Science (AREA)
  • General Physics & Mathematics (AREA)
  • Computational Linguistics (AREA)
  • Data Mining & Analysis (AREA)
  • Databases & Information Systems (AREA)
  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)
  • Memory System Of A Hierarchy Structure (AREA)

Abstract

The embodiment of the invention provides a cache control method, a cache control device, cache control equipment and a storage medium. The method comprises the following steps: acquiring data query information; determining data query repetition rate information according to the data query information; and controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information. The method of the embodiment of the invention realizes the dynamic control of the cache.

Description

Cache control method, device, equipment and storage medium
Technical Field
The present invention relates to the field of data storage technologies, and in particular, to a cache control method, apparatus, device, and storage medium.
Background
According to the cache technology, hot spot data are stored in a cache, when the data need to be read, the data are firstly searched from the cache, and can be immediately read and processed after being found, and the data do not need to be read from a memory with relatively low speed, so that repeated creation, processing and transmission of the data can be avoided, the data query efficiency and the application response speed are improved, and the burden and the pressure of a system are greatly relieved.
In the prior art, the pressure of a database can be relieved by caching for high-frequency data requests, and if the cache is hit, the data query efficiency can be improved; for the low-frequency data requests, the cache module may not cache the corresponding data, and needs to penetrate through the database for data query, which increases the data query time and affects the efficiency. Generally, the data query efficiency is improved by a form of multi-level cache or by setting a bloom filter, but system codes need to be modified, that is, business logic needs to be adjusted, and business system upgrading or updating needs to be performed, so that the implementation process is complex and difficult.
Disclosure of Invention
To solve the problems in the prior art, embodiments of the present invention provide a cache control method, apparatus, device, and storage medium.
Specifically, the embodiment of the invention provides the following technical scheme:
in a first aspect, an embodiment of the present invention provides a cache control method, including:
acquiring data query information;
determining data query repetition rate information according to the data query information;
and controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
Further, the data query information includes: the total query times of the data and the query times of at least one piece of data;
the data query repetition rate information comprises a data query repetition rate variance;
the determining data query repetition rate information according to the data query information includes:
and determining the data query repetition rate variance according to the total data query times and the at least one data query time.
Further, the determining the data query repetition rate variance includes:
dividing the query times of each piece of data by the total query times of the data to obtain the query repetition rate of each piece of data;
and carrying out variance operation based on the query repetition rate of each piece of data to obtain the data query repetition rate variance.
Further, the controlling the operation state of the cache module in the electronic device according to the data query repetition rate information includes:
if the data query repetition rate variance is smaller than a first threshold, controlling the running state of the cache module to be in an open state;
and if the data query repetition rate variance is larger than or equal to the first threshold, controlling the running state of the cache module to be in a closed state.
Further, the controlling the running state of the cache module to be in an open state includes:
and if the cache module is in a closed state, issuing an opening instruction to the electronic equipment.
Further, the method further comprises:
and updating the data with the query times larger than or equal to a second threshold value to the cache module.
Further, the controlling the running state of the cache module to be in a closed state includes:
and if the cache module is in the open state, issuing a closing instruction to the electronic equipment.
Further, the opening instruction is converted into the electronic equipment identification configuration parameter, and the electronic equipment is used for controlling the cache module to be opened by loading the configuration parameter.
Further, the closing instruction is converted into the electronic device identification configuration parameter, and the electronic device is used for controlling the cache module to close by loading the configuration parameter.
Further, the obtaining data query information includes:
acquiring a system log according to the IP address and the port of the electronic equipment;
and acquiring the data query information according to the system log.
In a second aspect, an embodiment of the present invention further provides a cache control apparatus, including:
the acquisition module is used for acquiring data query information;
the processing module is used for determining data query repetition rate information according to the data query information;
and the processing module is also used for controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
In a third aspect, an embodiment of the present invention further provides an electronic device, including a memory, a processor, and a computer program stored in the memory and executable on the processor, where the processor implements the steps of the cache control method according to the first aspect when executing the program.
In a fourth aspect, the present invention further provides a non-transitory computer-readable storage medium, on which a computer program is stored, where the computer program, when executed by a processor, implements the steps of the cache control method according to the first aspect.
In a fifth aspect, an embodiment of the present invention further provides a computer program product, which includes a computer program, and when the computer program is executed by a processor, the computer program implements the steps of the cache control method according to the first aspect.
According to the cache control method, the cache control device, the cache control equipment and the cache control storage medium, data query information is obtained in real time, and data query repetition rate information is determined according to the data query information, wherein the data query repetition rate information reflects repeated query conditions of a user on data, such as whether the data is repeatedly queried by the user for many times or is less queried by the user; and further, whether the cache module in the electronic equipment needs to be opened or closed is determined according to the data query repetition rate information, so that the accuracy and timeliness of cache control are improved, and the dynamic control of the cache is efficiently realized.
Drawings
In order to more clearly illustrate the technical solutions of the present invention or the prior art, the drawings needed for the description of the embodiments or the prior art will be briefly described below, and it is obvious that the drawings in the following description are some embodiments of the present invention, and those skilled in the art can also obtain other drawings according to the drawings without creative efforts.
Fig. 1 is a schematic flowchart of a cache control method according to an embodiment of the present invention;
fig. 2 is a frame diagram of an implementation of a cache control method according to an embodiment of the present invention;
fig. 3 is another schematic flow chart of a cache control method according to an embodiment of the present invention;
fig. 4 is a schematic structural diagram of a cache control apparatus according to an embodiment of the present invention;
fig. 5 is a schematic structural diagram of an electronic device according to an embodiment of the present invention.
Detailed Description
In order to make the objects, technical solutions and advantages of the present invention clearer, the technical solutions of the present invention will be clearly and completely described below with reference to the accompanying drawings, and it is obvious that the described embodiments are some, but not all embodiments of the present invention. All other embodiments, which can be derived by a person skilled in the art from the embodiments given herein without making any creative effort, shall fall within the protection scope of the present invention.
The method of the embodiment of the invention can be applied to a cache control scene to realize the dynamic control of the cache.
In the related technology, the cache technology stores the hot spot data in the cache, when the data needs to be read, the data is firstly searched from the cache and can be immediately read and processed after being found, and the data does not need to be read from a memory with relatively low speed, so that repeated creation, processing and transmission of the data can be avoided, the data query efficiency and the application response speed are improved, and the burden and the pressure of a system are greatly relieved.
In the prior art, the pressure of a database can be relieved by caching for high-frequency data requests, and if the cache is hit, the data query efficiency can be improved; for the low-frequency data requests, the cache module may not cache the corresponding data, and needs to penetrate through the database to perform data query, which increases the data query time and affects the efficiency. Generally, the data query efficiency is improved by a form of multi-level cache or by setting a bloom filter, but system codes need to be modified, that is, business logic needs to be adjusted, and a business system needs to be upgraded or updated, which is complex and difficult to implement. The cache control method of the embodiment of the invention determines the data query repetition rate information according to the data query information by acquiring the data query information in real time, wherein the data query repetition rate information reflects the repeated query condition of the user to the data, such as whether the data is repeatedly queried by the user for many times or is rarely queried by the user; and further, whether the cache module in the electronic equipment needs to be opened or closed is determined according to the data query repetition rate information, so that the accuracy and timeliness of cache control are improved, and the dynamic control of the cache is efficiently realized.
The technical solution of the present invention is described in detail with specific embodiments in conjunction with fig. 1-5. The following several specific embodiments may be combined with each other, and details of the same or similar concepts or processes may not be repeated in some embodiments.
Fig. 1 is a flowchart illustrating a cache control method according to an embodiment of the present invention. As shown in fig. 1, the method provided by this embodiment includes:
step 101, acquiring data query information;
specifically, data query information is acquired, wherein the data query information comprises data query information stored in a database or a server; the data query information may be obtained according to a certain time granularity, which is not limited in this embodiment,
for example, the data query information is acquired every 10 minutes, so as to achieve the purpose of acquiring the query information in real time.
For example, data query information is obtained from the database every 10 minutes, wherein the data query obtained at a certain time is as follows: the user inquires the data in the database for 100 times in total, wherein the data A is inquired for 5 times; the total number of queries of the data in the database included in the query information is 100, and the number of queries of the data a is 5.
Step 102, determining data query repetition rate information according to the data query information;
specifically, query repetition rate information is determined according to the data query information, wherein the query repetition rate includes a situation that the data is repeatedly queried by the user.
For example, when the total query times of data in the data query information of a certain time of 10 minutes is 100 times, and the query times of data a is 5 times, the query repetition rate of the data a is: dividing the query frequency 5 of the data A by the total query frequency 100 of the data, namely the query repetition rate result of the data A is 5%; if the query frequency of the data B is 10, the query repetition rate of the data B is: dividing the query frequency 10 of the data B by the total query frequency 100 of the data, namely the query repetition rate result of the data B is 10%; processing the query repetition rate of the data A, the data B and other data according to corresponding rules to obtain query repetition rate information; for example, variance operation is performed on the query repetition rates of the data a, the data B and other data, so that the data query repetition rate information can be determined.
And 103, inquiring the repetition rate information according to the data, and controlling the running state of a cache module in the electronic equipment.
Specifically, after the data repetition rate query information is determined, whether the operation state of the cache module needs to be adjusted or not can be determined according to the data query rate. The method comprises the steps that data query information and a data query repetition rate are obtained in real time, and a cache module of the electronic equipment is dynamically started or closed; the method is transparent to the user and does not affect the normal service operation; the business system is low-invasive, and the business system does not need to be upgraded or updated.
For example, when it is determined that the data repetition rate query information includes C, it may be determined whether the operation state of the cache module needs to be adjusted according to the numerical condition of C; the adjustment mode comprises the following steps: if C is smaller than the threshold D, controlling the cache module to be in an open state; and if the C is larger than the threshold D, controlling the cache module to be in a closed state.
In the above embodiment, the data query information is obtained in real time, and the data query repetition rate information is determined according to the data query information, where the data query repetition rate information reflects the repeated query condition of the user on the data, such as whether the data is repeatedly queried by the user for many times or is queried by the user less; and further, whether the cache module in the electronic equipment needs to be opened or closed is determined according to the data query repetition rate information, so that the accuracy and timeliness of cache control are improved, and the dynamic control of the cache is efficiently realized.
In one embodiment, the data query information includes: the total query times of the data and the query times of at least one piece of data;
the data query repetition rate information includes a data query repetition rate variance;
determining data query repetition rate information according to the data query information, comprising:
and determining the data query repetition rate variance according to the total data query times and the at least one data query time.
Specifically, the data query information includes the total query times of the data and the query times of at least one piece of data; determining a data query repetition rate variance according to the total query times of the data and the query times of each piece of data included in the data query information; wherein the data query repetition rate information comprises the data query repetition rate variance.
For example, in the data query information in a certain time period, the query information includes that the total query times of the data is 100 times, the query times of the data a is 5 times, and the query times of the data B is 95 times; determining a data query rate variance according to the total query times 100, the query times 5 of the data A and the query times 95 of the data B in the query information; the data query repetition rate information contains the data query rate variance, and reflects the repeated query condition of the user to the data.
In the above embodiment, the data query repetition rate information is determined according to the total number of data queries and the number of queries of at least one piece of data in the obtained data query information, where the data query repetition rate information includes a data query repetition rate variance, and reflects a repeated query condition of a user on data; whether the state of the cache module of the electronic equipment needs to be controlled and adjusted can be judged through the determined data repetition rate information, namely, basic data support can be provided for cache control through the determination of the data repetition rate information, and the accuracy and timeliness of the cache control are improved.
In one embodiment, determining a data query repetition rate variance comprises:
dividing the query times of each piece of data by the total query times of the data to obtain the query repetition rate of each piece of data;
and carrying out variance operation based on the query repetition rate of each piece of data to obtain the data query repetition rate variance.
Specifically, the method for determining the variance of the data query repetition rate includes: dividing the query times of each piece of data in the data query information by the total query times of the data respectively to obtain the repeated query rate of each piece of data; and then carrying out variance operation on the repeated query rate of each piece of data to obtain the data query repeated rate variance.
For example, in the data query information in a certain time period, the query information includes that the total query times of data is 15 times, the query times of data a is 1 time, the query times of data B is 2 times, the query times of data C is 3 times, the query times of data D is 4 times, and the query times of data E is 5 times; according to the total query times 15, the query times 1 of the data A, the query times 2 of the data B, the query times 3 of the data C, the query times 4 of the data D and the query times 5 of the data E in the query information, the data query repetition rate variance can be determined to be 2. The data query repetition rate variance reflects the repeated query condition of the user to the data.
In the above embodiment, the query repetition rate of each piece of data is obtained by dividing the query frequency of each piece of data by the total query frequency of the data; performing variance operation based on the query repetition rate of each piece of data to obtain a data query repetition rate variance; the data query repetition rate variance information reflects the repeated query condition of the user to the data; whether the state of a cache module of the electronic equipment needs to be controlled and adjusted can be judged through the determined data repetition rate variance information, namely, basic data support can be provided for cache control through the determination of the data repetition rate variance information, and the accuracy and timeliness of the cache control are improved.
In one embodiment, the controlling the operating state of the cache module in the electronic device according to the data query repetition rate information includes:
if the data query repetition rate variance is smaller than a first threshold, controlling the running state of the cache module to be in an open state;
and if the data query repetition rate variance is larger than or equal to a first threshold, controlling the running state of the cache module to be in a closed state.
Specifically, if the data query repetition rate variance is smaller than a first threshold value in the data query repetition information, the running state of the cache module is controlled to be in an open state; if the data query repetition rate variance is larger than or equal to a first threshold, controlling the running state of the cache module to be in a closed state; the first threshold is a preset value and is used for judging and controlling the running state of the cache module. Query distributions are typically divided into peaks and valleys; when the wave crest or the wave trough is positioned, the flow is basically in a stable state, and the buffer does not need to be intervened; when the flow query changes from a wave trough to a wave crest, for example, during commodity shopping, the repeated query rate of data is higher and higher, the overall data variance is smaller and smaller, when the data is smaller than a certain threshold value, the cache is started, and at this time, the flow is in a wave crest segment, and the cache is in a started state; similarly, when the flow changes from the peak to the trough, the repeated data query rate is lower and lower, i.e. tends to be in an unstable state, at this time, the overall data variance is larger and larger, and when the flow is larger than a certain threshold, the cache is closed. The data query repetition rate variance is effective when fluctuation occurs and then the cache is opened or closed.
For example, the first threshold is preset to 5, and if the data query repetition rate variance is determined to be 2 according to the total data query times and the data query times in the data query information in a certain time period, the operating state of the cache module is controlled to be in an open state; and if the data query repetition rate variance determined in the next period is 8, controlling the running state of the cache module to be in a closed state.
In the above embodiment, the running state of the cache module is further controlled to be in an open state or a closed state by judging the relationship between the data query rate variance and the first threshold; when the query changes from a trough to a peak, the repeated query rate of the data is higher and higher, the overall data variance is smaller and smaller, and when the query is smaller than a certain threshold value, the cache is controlled to be in an open state; similarly, when the flow changes from the peak to the trough, the repeated data query rate is lower and lower, namely tends to be in an unstable state, the overall data variance is larger and larger, and when the flow is larger than a certain threshold, the cache is controlled to be in a closed state; basic data support can be provided for cache control through the data repetition rate variance, accuracy and timeliness of cache control are improved, and dynamic cache control is achieved.
In one embodiment, controlling the running state of the cache module to be in an open state includes:
and if the cache module is in the closed state, issuing an opening instruction to the electronic equipment.
Specifically, if the data query repetition rate variance is smaller than a first threshold value in a certain time period, when the cache module is in a closed state, an open instruction is issued to the electronic device, and the running state of the cache module is controlled to be in an open state.
For example, when the data query repetition rate is 2 in a certain time period, the first threshold is 5, and the data query repetition rate is less than 5; and when the cache module is in the closed state, issuing an opening instruction to the electronic equipment to control the running state of the cache module to be in the open state.
In the above embodiment, when the data query repetition rate variance is smaller than the first threshold and the cache module is judged to be in the closed state, an open instruction is issued to the electronic device to control the running state of the cache module to be in the open state; by the method, the cache module is adjusted from the closed state to the open state, namely, the cache module is opened timely and accurately according to real-time user requirements, and dynamic control of the cache is realized.
In an embodiment, the cache control method further includes: and updating the data with the query times larger than or equal to the second threshold value to the cache module.
Specifically, when the variance of the data query repetition rate is smaller than a first threshold value and the cache module is judged to be in a closed state, an opening instruction is issued to the electronic equipment to control the running state of the cache module to be in an open state, and data with the query times larger than or equal to a second threshold value is updated to the cache module; the second threshold is a preset value and is used for judging which data need to be updated to the cache module, so that the data query efficiency and the response speed are improved.
For example, the second threshold is 5, when it is determined that the cache module needs to be started, the query frequency of the data a is 2, and the query frequency of the data B is 8; the data B is updated to the cache module.
In the above embodiment, when the cache module needs to be started, the relationship between the query times of each piece of data and the second threshold is determined, and the data with the query times larger than the second threshold is updated to the cache module, that is, the data with the higher query times is updated to the cache module, so that the data query efficiency and the response speed can be improved.
In one embodiment, controlling the running state of the cache module to be in the off state includes:
and if the cache module is in the opening state, issuing a closing instruction to the electronic equipment.
Specifically, if the data query repetition rate variance is greater than a first threshold value in a certain time period, when the cache module is in an open state, an open instruction is issued to the electronic device, and the running state of the cache module is controlled to be in a closed state.
For example, when the data query repetition rate is 8 and the first threshold is 5 for a certain period of time, the data query repetition rate is greater than the first threshold of 5; and when the cache module is in the open state, issuing an open instruction to the electronic equipment to control the running state of the cache module to be in the closed state.
In the above embodiment, when the variance of the data query repetition rate is greater than the first threshold and the cache module is determined to be in the on state, a close instruction is issued to the electronic device to control the running state of the cache module to be in the off state; by the method, the cache module is adjusted from the open state to the closed state, the cache module is closed timely and accurately, the occupation of system resources is reduced, and the dynamic control of the cache is realized.
In an embodiment, the opening instruction is converted into an electronic device identification configuration parameter, and the electronic device controls the cache module to open by loading the configuration parameter.
Specifically, when the cache module is judged to be required to be started, the starting instruction is converted into an electronic equipment identification configuration parameter; the electronic equipment obtains the information of the cache module needing to be started by loading the configuration parameters, and starts the corresponding cache module.
In the above embodiment, after the start instruction is converted into the configuration parameter recognized by the electronic device, the electronic device can accurately acquire the information of the cache module to be started after loading the configuration parameter recognized by the electronic device, and start the corresponding cache module, thereby accurately realizing dynamic control of the cache.
In an embodiment, the closing instruction is converted into the electronic device identification configuration parameter, and the electronic device controls the cache module to close by loading the configuration parameter.
Specifically, when the cache module needs to be closed, the closing instruction is converted into an electronic equipment identification configuration parameter; the electronic equipment obtains the information of the cache module needing to be closed by loading the configuration parameters, and closes the corresponding cache module.
In the above embodiment, after the closing instruction is converted into the configuration parameters recognized by the electronic device, the electronic device can accurately acquire the information of the cache module to be closed by loading the configuration parameters recognized by the electronic device, and close the corresponding cache module, thereby accurately realizing dynamic control of the cache.
In one embodiment, obtaining data query information includes:
acquiring a system log according to the IP address and the port of the electronic equipment;
and acquiring data query information according to the system log.
Specifically, the method for acquiring the data query information includes: and acquiring a system log of the electronic equipment according to the IP address and the port of the electronic equipment where the query data is located, and acquiring data query information through the system log.
For example, to acquire the data query information stored in the electronic device a, a system log may be acquired through the IP address and the port of the electronic device a, and the data query information in the electronic device a may be acquired through the system log.
In the above embodiment, after the system log is acquired through the IP address and the port of the electronic device, the required data query information can be accurately acquired, so as to provide accurate basic data for dynamically controlling the cache, and improve the accuracy of dynamic control of the cache.
Illustratively, the implementation framework of the present embodiment is shown in fig. 2:
firstly, a data collection module acquires data query information, a data analysis module determines data query repetition rate information according to the data query information, judges how to perform dynamic control on a cache module, converts a corresponding instruction into a configuration parameter identified by a service system server and sends the configuration parameter to the service system server; the service end of the service system comprises a cache module and a cache switch; the service end of the service system receives the configuration parameters of the instruction issuing module, dynamically loads the configuration parameters, and further opens or closes a cache module in the service end of the service system, and the cache module takes effect in a Remote Dictionary service (Redis) cluster; wherein a Redis cluster is a distributed data storage system. The service end of the business system is the electronic equipment comprising the cache module.
For example, the specific flow of the cache control method is shown in fig. 3:
step 1, collecting data;
the data collection module acquires data query information through an IP address and a port of the electronic equipment service system; the data query information comprises the total query times of the data and the query times of at least one piece of data;
step 2, analyzing data;
the data analysis module divides the query times of each piece of data by the total query times of the data to obtain the query repetition rate of each piece of data; and carrying out variance operation based on the query repetition rate of each piece of data to obtain the data query repetition rate variance.
Step 3, issuing an instruction;
if the data query repetition rate variance is smaller than a first threshold value, judging that the running state of the control cache module is in an open state; and if the data query repetition rate variance is larger than or equal to a first threshold, judging that the running state of the control cache module is in a closed state.
If the cache module is in a closed state, converting the opening instruction into an electronic equipment identification configuration parameter for issuing, so that the electronic equipment controls the cache module to be opened by loading the configuration parameter, and updating the data of which the query times is greater than or equal to a second threshold value to the cache module; if the cache module is in the open state, the closing instruction is converted into the electronic equipment identification configuration parameter for issuing.
Step 4, controlling the state of the cache module;
and after receiving the configuration parameters of the instruction issuing module, the service end of the service system carries out dynamic loading, and further starts or closes the cache module, and enables the cache module to take effect in the Redis cluster system.
In the above embodiment, the data query information is obtained in real time, and the data query repetition rate information is determined according to the data query information, where the data query repetition rate information reflects a repeated query condition of the user on the data, such as whether the data is repeatedly queried by the user for many times or is queried by the user less; and further, whether the cache module in the electronic equipment needs to be opened or closed is determined according to the data query repetition rate information, so that the accuracy and timeliness of cache control are improved, and the dynamic control of the cache is efficiently realized.
The following describes the cache control device provided by the present invention, and the cache control device described below and the cache control method described above may be referred to correspondingly.
Fig. 4 is a schematic structural diagram of a cache control device provided in the present invention. The cache control device provided by this embodiment includes:
an obtaining module 710, configured to obtain data query information;
a processing module 720, configured to determine data query repetition rate information according to the data query information;
the processing module 720 is further configured to control an operating state of a cache module in the electronic device according to the data query repetition rate information.
Optionally, the obtaining module 710 is specifically configured to:
the total number of queries of the data and the number of queries of at least one piece of data.
Optionally, the processing module 720 is specifically configured to:
and determining the data query repetition rate variance according to the total data query times and the at least one data query time.
Optionally, the processing module 720 is specifically configured to:
dividing the query times of each piece of data by the total query times of the data to obtain the query repetition rate of each piece of data;
and carrying out variance operation based on the query repetition rate of each piece of data to obtain the data query repetition rate variance.
Optionally, the processing module 720 is specifically configured to: if the data query repetition rate variance is smaller than a first threshold, controlling the running state of the cache module to be in an open state;
and if the data query repetition rate variance is larger than or equal to a first threshold, controlling the running state of the cache module to be in a closed state.
Optionally, the processing module 720 is specifically configured to:
and if the cache module is in the closed state, issuing an opening instruction to the electronic equipment.
Optionally, the processing module 720 is specifically configured to:
and updating the data with the query times larger than or equal to the second threshold value to the cache module.
Optionally, the processing module 720 is specifically configured to:
and if the cache module is in the opening state, issuing a closing instruction to the electronic equipment.
Optionally, the processing module 720 is specifically configured to:
and converting the opening instruction into an electronic equipment identification configuration parameter for the electronic equipment to control the opening of the cache module by loading the configuration parameter.
Optionally, the processing module 720 is specifically configured to:
and converting the closing instruction into an electronic equipment identification configuration parameter for controlling the cache module to close by the electronic equipment through loading the configuration parameter.
Optionally, the processing module 720 is specifically configured to:
acquiring a system log according to the IP address and the port of the electronic equipment;
and acquiring data query information according to the system log.
The apparatus of the embodiment of the present invention is configured to perform the method of any of the foregoing method embodiments, and the implementation principle and the technical effect are similar, which are not described herein again.
Fig. 5 illustrates a physical structure diagram of an electronic device, which may include: a processor (processor)810, a communication Interface 820, a memory 830 and a communication bus 840, wherein the processor 810, the communication Interface 820 and the memory 830 communicate with each other via the communication bus 840. Processor 810 may call logic instructions in memory 830 to perform a cache control method comprising: acquiring data query information; determining data query repetition rate information according to the data query information; and controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
In addition, the logic instructions in the memory 830 can be implemented in the form of software functional units and stored in a computer readable storage medium when the software functional units are sold or used as independent products. Based on such understanding, the technical solution of the present invention may be embodied in the form of a software product, which is stored in a storage medium and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device) to execute all or part of the steps of the method according to the embodiments of the present invention. And the aforementioned storage medium includes: a U-disk, a removable hard disk, a Read-Only Memory (ROM), a Random Access Memory (RAM), a magnetic disk or an optical disk, and other various media capable of storing program codes.
In another aspect, the present invention also provides a computer program product, which includes a computer program stored on a non-transitory computer-readable storage medium, the computer program including program instructions, when the program instructions are executed by a computer, the computer being capable of executing the cache control method provided by the above methods, the method including: acquiring data query information; determining data query repetition rate information according to the data query information; and controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
In yet another aspect, the present invention also provides a non-transitory computer-readable storage medium, on which a computer program is stored, the computer program being implemented by a processor to perform the cache control method provided in the above aspects, the method comprising: acquiring data query information; determining data query repetition rate information according to the data query information; and controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
The above-described embodiments of the apparatus are merely illustrative, and the units described as separate parts may or may not be physically separate, and parts displayed 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 modules may be selected according to actual needs to achieve the purpose of the solution of the present embodiment. One of ordinary skill in the art can understand and implement it without inventive effort.
Through the above description of the embodiments, those skilled in the art will clearly understand that each embodiment can be implemented by software plus a necessary general hardware platform, and certainly can also be implemented by hardware. With this understanding in mind, the above-described technical solutions may be embodied in the form of a software product, which can be stored in a computer-readable storage medium such as ROM/RAM, magnetic disk, optical disk, etc., and includes instructions for causing a computer device (which may be a personal computer, a server, or a network device, etc.) to execute the methods described in the embodiments or some parts of the embodiments.
Finally, it should be noted that: the above examples are only intended to illustrate the technical solution of the present invention, but not to limit it; although the present invention has been described in detail with reference to the foregoing embodiments, it will be understood by those of ordinary skill in the art that: the technical solutions described in the foregoing embodiments may still be modified, or some technical features may be equivalently replaced; and such modifications or substitutions do not depart from the spirit and scope of the corresponding technical solutions of the embodiments of the present invention.

Claims (14)

1. A cache control method, comprising:
acquiring data query information;
determining data query repetition rate information according to the data query information;
and controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
2. The cache control method according to claim 1, wherein the data query information comprises: the total query times of the data and the query times of at least one piece of data; the data query repetition rate information comprises a data query repetition rate variance; the determining data query repetition rate information according to the data query information includes:
and determining the data query repetition rate variance according to the total data query times and the at least one data query time.
3. The cache control method of claim 2, wherein the determining a data query repetition rate variance comprises:
dividing the query times of each piece of data by the total query times of the data to obtain the query repetition rate of each piece of data;
and carrying out variance operation based on the query repetition rate of each piece of data to obtain the data query repetition rate variance.
4. The cache control method according to claim 2 or 3, wherein the controlling the operation state of the cache module in the electronic device according to the data query repetition rate information comprises:
if the data query repetition rate variance is smaller than a first threshold, controlling the running state of the cache module to be in an open state;
and if the data query repetition rate variance is larger than or equal to the first threshold, controlling the running state of the cache module to be in a closed state.
5. The cache control method according to claim 4, wherein the controlling the running state of the cache module to be in an open state comprises:
and if the cache module is in a closed state, issuing an opening instruction to the electronic equipment.
6. The cache control method of claim 4, further comprising:
and updating the data with the query times larger than or equal to a second threshold value to the cache module.
7. The cache control method according to claim 4, wherein the controlling the running state of the cache module to be in an off state comprises:
and if the cache module is in the open state, issuing a closing instruction to the electronic equipment.
8. The cache control method according to claim 5, wherein the method further comprises:
and converting the starting instruction into the electronic equipment identification configuration parameter, and controlling the cache module to be started by the electronic equipment through loading the configuration parameter.
9. The cache control method of claim 7, further comprising:
and converting the closing instruction into the electronic equipment identification configuration parameter, and controlling the cache module to close by the electronic equipment through loading the configuration parameter.
10. The cache control method according to any one of claims 1 to 3, wherein the obtaining data query information includes:
acquiring a system log according to the IP address and the port of the electronic equipment;
and acquiring the data query information according to the system log.
11. A cache control apparatus, comprising:
the acquisition module is used for acquiring data query information;
the processing module is used for determining data query repetition rate information according to the data query information;
and the processing module is also used for controlling the running state of a cache module in the electronic equipment according to the data query repetition rate information.
12. An electronic device comprising a memory, a processor and a computer program stored on the memory and executable on the processor, characterized in that the steps of the cache control method according to any of claims 1 to 10 are implemented when the processor executes the program.
13. A non-transitory computer readable storage medium, on which a computer program is stored, which, when being executed by a processor, performs the steps of the cache control method according to any one of claims 1 to 10.
14. A computer program product having stored thereon executable instructions, characterized in that the instructions, when executed by a processor, cause the processor to carry out the steps of the cache control method according to any one of claims 1 to 10.
CN202210006920.9A 2022-01-05 2022-01-05 Cache control method, device, equipment and storage medium Pending CN114547093A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202210006920.9A CN114547093A (en) 2022-01-05 2022-01-05 Cache control method, device, equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202210006920.9A CN114547093A (en) 2022-01-05 2022-01-05 Cache control method, device, equipment and storage medium

Publications (1)

Publication Number Publication Date
CN114547093A true CN114547093A (en) 2022-05-27

Family

ID=81669863

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202210006920.9A Pending CN114547093A (en) 2022-01-05 2022-01-05 Cache control method, device, equipment and storage medium

Country Status (1)

Country Link
CN (1) CN114547093A (en)

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331919A (en) * 2023-09-18 2024-01-02 本原数据(北京)信息技术有限公司 Database joint query method and device, electronic equipment and storage medium

Cited By (1)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN117331919A (en) * 2023-09-18 2024-01-02 本原数据(北京)信息技术有限公司 Database joint query method and device, electronic equipment and storage medium

Similar Documents

Publication Publication Date Title
CN107832126B (en) Thread adjusting method and terminal thereof
CN110109953A (en) A kind of data query method, device and equipment
CN102446171B (en) The method and apparatus of keyword quality score is promoted based on the evaluation and test of weighted mean click-through rate
CN110941424B (en) Compiling parameter optimization method and device and electronic equipment
CN109218054B (en) Terminal dynamic configuration, corresponding server implementation method, device and storage medium
CN107688626B (en) Slow query log processing method and device and electronic equipment
CN109684079A (en) Data display processing method, device and electronic equipment
CN113391973B (en) Internet of things cloud container log collection method and device
CN114547093A (en) Cache control method, device, equipment and storage medium
CN111030850B (en) SCADA system data acquisition period control method and device
CN110276070B (en) Corpus processing method, apparatus and storage medium
CN110109970B (en) Data query processing method and device
CN116501468A (en) Batch job processing method and device and electronic equipment
KR102516412B1 (en) GPU clock control method and device for machine learning
CN115208893A (en) Resource scheduling method and device
CN114020766A (en) Data query method and device and terminal equipment
CN113035192A (en) Voice recognition method of fan voice control system
CN111179060A (en) Transaction path selection method and device in transfer processing process
CN112148554A (en) Method and device for calculating occupation size of redis service data in real time
CN109522124A (en) Storage management system loading method, device, equipment and readable storage medium storing program for executing
CN113806651B (en) Data caching method, device, server and storage medium
CN111309754B (en) Service data access method, device, storage medium and electronic equipment
CN112597157B (en) Method and system for storing and managing submission information
CN112804363B (en) Cache resource processing method and device based on multi-cloud fusion
CN109542601B (en) Policy compiling method and device, electronic equipment and computer storage medium

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