CN115665245A - Local cache refreshing method and device, electronic equipment and storage medium - Google Patents

Local cache refreshing method and device, electronic equipment and storage medium Download PDF

Info

Publication number
CN115665245A
CN115665245A CN202211310767.5A CN202211310767A CN115665245A CN 115665245 A CN115665245 A CN 115665245A CN 202211310767 A CN202211310767 A CN 202211310767A CN 115665245 A CN115665245 A CN 115665245A
Authority
CN
China
Prior art keywords
cache
node
refreshing
refreshed
current
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
CN202211310767.5A
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.)
Agricultural Bank of China
Original Assignee
Agricultural Bank of China
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 Agricultural Bank of China filed Critical Agricultural Bank of China
Priority to CN202211310767.5A priority Critical patent/CN115665245A/en
Publication of CN115665245A publication Critical patent/CN115665245A/en
Pending legal-status Critical Current

Links

Images

Landscapes

  • Information Retrieval, Db Structures And Fs Structures Therefor (AREA)

Abstract

The embodiment of the invention discloses a local cache refreshing method and device, electronic equipment and a storage medium. The local cache refreshing method may specifically include: determining a current refreshing cache node, and performing cache refreshing on a local cache of the current refreshing cache node; and under the condition that the local cache of the current cache refreshing node is successfully refreshed, determining a cache node to be refreshed through the current cache refreshing node so as to refresh the local cache of the cache node to be refreshed. The technical scheme of the embodiment of the invention can timely carry out cache refreshing on the local cache of each node in the cluster, thereby improving the accuracy of data query.

Description

Local cache refreshing method and device, electronic equipment and storage medium
Technical Field
The embodiment of the invention relates to the technical field of computers, in particular to a local cache refreshing method and device, electronic equipment and a storage medium.
Background
With the development of technology, the content information stored in the database is more and more complex, and the access amount of the database is larger and larger, however, the number of requests that the database can accept per second is limited. Therefore, the standard process is broken through by introducing the cache, and the database query request in each link can directly acquire the target data from the cache and return the target data, so that the calculated amount is reduced, the response speed is effectively improved, and more users are served by limited resources.
Due to the high query concurrency and the interface response time requirement, when each node under the cluster is started, data in the database is cached in the memory of the node, and when the data is queried from the database, the data is converted into the data which is queried from the memory, so that the local caching is realized, and the high concurrency requirement is realized. However, when performing a cache refresh operation, the existing local cache refresh method can only perform cache refresh on one node in the cluster per cache refresh operation. Therefore, the cache data of the existing local cache refreshing method is not refreshed timely, so that the queried data is dirty data, and the query accuracy rate is reduced.
Disclosure of Invention
Embodiments of the present invention provide a local cache refreshing method and apparatus, an electronic device, and a storage medium, which can perform cache refreshing on a local cache of each node in a cluster in time, thereby improving accuracy of querying data.
According to an aspect of the present invention, a local cache refreshing method is provided, including:
determining a current refreshing cache node, and performing cache refreshing on a local cache of the current refreshing cache node;
and under the condition that the local cache of the current cache refreshing node is successfully refreshed, determining a cache node to be refreshed through the current cache refreshing node so as to perform cache refreshing on the local cache of the cache node to be refreshed.
According to another aspect of the present invention, there is provided a local cache refreshing apparatus, including:
the first cache refreshing module is used for determining a current refreshing cache node and performing cache refreshing on a local cache of the current refreshing cache node;
and the second cache refreshing module is used for determining the cache node to be refreshed through the current refreshing cache node under the condition that the local cache of the current refreshing cache node is successfully refreshed, so as to perform cache refreshing on the local cache of the cache node to be refreshed.
According to another aspect of the present invention, there is provided an electronic apparatus including:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor, the computer program being executable by the at least one processor to enable the at least one processor to perform a local cache refresh method according to any of the embodiments of the present invention.
According to another aspect of the present invention, there is provided a computer-readable storage medium storing computer instructions for causing a processor to implement a local cache refresh method according to any one of the embodiments of the present invention when the computer instructions are executed.
According to the technical scheme of the embodiment of the invention, the current refreshing cache node is determined, and the local cache of the current refreshing cache node is subjected to cache refreshing, so that when the local cache of the current refreshing cache node is successfully refreshed, the cache node to be refreshed is determined through the current refreshing cache node, and the local cache of the cache node to be refreshed is subjected to cache refreshing, the problem that the query data is dirty data due to untimely cache data refreshing in the existing local cache refreshing method is solved, the local cache of each node in a cluster can be timely refreshed, and the accuracy of the query data is improved.
It should be understood that the statements in this section do not necessarily identify key or critical features of the embodiments of the present invention, nor do they necessarily limit the scope of the invention. Other features of the present invention will become apparent from the following description.
Drawings
In order to more clearly illustrate the technical solutions in the embodiments of the present invention, the drawings needed to be used in the description of the embodiments will be briefly introduced below, and it is obvious that the drawings in the following description are only some embodiments of the present invention, and it is obvious for those skilled in the art to obtain other drawings based on these drawings without creative efforts.
Fig. 1 is a flowchart of a local cache refreshing method according to an embodiment of the present invention;
fig. 2 is a flowchart of a local cache refreshing method according to a second embodiment of the present invention;
fig. 3 is a schematic diagram illustrating an example of a local cache refreshing method according to a second embodiment of the present invention;
fig. 4 is an exemplary flowchart of a local cache refreshing method according to a second embodiment of the present invention;
fig. 5 is a schematic diagram of a local cache refreshing apparatus according to a third embodiment of the present invention;
fig. 6 is a schematic structural diagram of an electronic device implementing the local cache refreshing method according to the embodiment of the present invention.
Detailed Description
In order to make those skilled in the art better understand the technical solutions of the present invention, the technical solutions in the embodiments of the present invention will be clearly and completely described below with reference to the drawings in the embodiments of the present invention, and it is obvious that the described embodiments are only a part of the embodiments of the present invention, and not all of the embodiments. All other embodiments, which can be obtained by a person skilled in the art without making any creative effort based on the embodiments in the present invention, shall fall within the protection scope of the present invention.
It should be noted that the terms "first," "second," and the like in the description and claims of the present invention and in the drawings described above are used for distinguishing between similar elements and not necessarily for describing a particular sequential or chronological order. It is to be understood that the data so used is interchangeable under appropriate circumstances such that the embodiments of the invention described herein are capable of operation in other sequences than those illustrated or 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.
Clustering: a group of mutually independent computers interconnected through a high-speed network constitute a group and are managed in a single system mode. A client interacts with a cluster, which appears as a stand-alone server. A cluster may include two concepts: load balancing (load balancing) and failure takeover (failover).
Load balancing: the multiple clients send requests simultaneously, and the load balancer at the front end shares the requests to idle machines according to a specific algorithm, so that high performance and good expansibility are achieved.
Caching: the application program interface is arranged between the application program and the physical data source and has the function of reducing the frequency of the access of the application program to the physical data source, thereby improving the running performance of the application program. The data in the cache is a copy of the data in the physical data source, the application program reads and writes data from the cache during operation, and the data of the cache and the physical data source can be synchronized at a specific time or event. According to the coupling degree of the cache and the application, the cache is divided into a local cache (local cache) and a distributed cache (remote cache).
Local caching: the method refers to a cache component in an application, and has the greatest advantages that the application and the cache are in the same process, the cache request is very quick, excessive network overhead does not exist, and the like. The disadvantage is that the cache is coupled with the application program, a plurality of application programs cannot be directly shared, each node needs to independently maintain the cache of itself, and other nodes cannot be informed to synchronously modify when the cache needs to be modified.
Distributed caching: the method refers to a cache component or service separated from an application, and has the greatest advantage that the cache component or service is an independent application and is isolated from the application, and a plurality of nodes can directly share the cache.
In the prior art, a system and a method for implementing a distributed application local cache are disclosed: the method comprises a cache manager, a cache service component, a cache builder, a cache monitor and a communicator. The cache manager is used for unified scheduling and management of other components, grouping management of cache, management of the life cycle of cache data, automatic removal of overdue cache data and management of cache data capacity; the cache service component is used for exposing an interface to the outside and is responsible for providing the service required by the user; the cache constructor is responsible for constructing cache entities, and different cache constructors can have different cache entities; the cache monitor is responsible for monitoring the cache; the communicator is responsible for synchronizing cache data among a plurality of application nodes in a cluster environment. Although the technical scheme can achieve synchronization of local cache data among a plurality of application nodes in a cluster mode, additional resources are needed to deploy communicator services, the communicator services are deployed separately from the applications, the integrity of the cluster is low, the distributed architecture principle is not met, cache synchronization of each application node fails once the communicator services are unavailable, the reliability is low, dirty data is easily generated, and system services are affected.
As can be seen, if a distributed cache manner is adopted when caching data in a database, an independent server resource needs to be introduced to deploy a service, which is high in cost and complex in configuration process and needs to be intrusive to an application. Therefore, in view of cost and implementation convenience, a local caching mode is adopted when the data in the database is cached.
Example one
Fig. 1 is a flowchart of a local cache refreshing method according to an embodiment of the present invention, where this embodiment is applicable to a situation where a local cache of each node in a cluster is refreshed in time, and the method may be executed by a local cache refreshing apparatus, and the apparatus may be implemented in a software and/or hardware manner, and may generally be directly integrated in an electronic device that executes the method, where the electronic device may be a terminal device or a server device. Specifically, as shown in fig. 1, the local cache refreshing method may specifically include the following steps:
s110, determining a current refreshing cache node, and performing cache refreshing on a local cache of the current refreshing cache node.
The current refresh cache node may be a node in the cluster that currently needs to refresh the local cache. It is to be understood that the current refresh cache node may be any node in the cluster. The cache flush may be an update to data in the local cache. It can be understood that when the data in the database is updated, the local cache of each node in the cluster can be refreshed.
In the embodiment of the invention, the current cache refreshing node is determined so as to perform cache refreshing on the local cache of the current cache refreshing node. Optionally, the cache refresh request is determined in response to a cache refresh instruction sent by a user at the management end, and the cache refresh request is sent to a node in the cluster through load balancing, where the node can be determined as the current refresh cache node. It is understood that the management side may be a management side on any node. When the load balancing sends the cache refresh request to the node, the load balancing may send the cache refresh request to the node through the cache refresh interface of the node.
Optionally, the performing cache refreshing on the local cache of the current refresh cache node may include reading, by the cache load service module of the current refresh cache node, updated data from the database after the current refresh cache node receives the cache refresh request, and performing cache refreshing on the local cache of the current refresh cache node according to the updated data.
S120, under the condition that the local cache of the current cache refreshing node is successfully refreshed, determining a cache node to be refreshed through the current cache refreshing node so as to perform cache refreshing on the local cache of the cache node to be refreshed.
The cache node to be refreshed may be a node that needs to perform cache refreshing on the local cache except the current cache refreshing node in the cluster.
In the embodiment of the present invention, after determining the current refresh cache node and performing cache refresh on the local cache of the current refresh cache node, it may be further determined whether the local cache of the current refresh cache node is successfully refreshed, and when the local cache of the current refresh cache node is successfully refreshed, the cache node to be refreshed is determined by the current refresh cache node, so as to perform cache refresh on the local cache of the cache node to be refreshed. It may be understood that there may be one or more cache nodes to be refreshed, and the embodiment of the present invention does not limit this. When there are multiple cache nodes to be refreshed, one cache node to be refreshed may be determined sequentially by the current cache refreshing node, or multiple cache nodes to be refreshed may be determined simultaneously by the current cache refreshing node, which is not limited in the embodiment of the present invention.
According to the technical scheme, the current refreshing cache node is determined, the local cache of the current refreshing cache node is subjected to cache refreshing, and when the local cache of the current refreshing cache node is successfully refreshed, the cache node to be refreshed is determined through the current refreshing cache node, so that the local cache of the cache node to be refreshed is subjected to cache refreshing.
Example two
Fig. 2 is a flowchart of a local cache refreshing method according to a second embodiment of the present invention, and this embodiment further details the above technical solutions, and provides multiple specific optional implementation manners for determining a cache node to be refreshed according to the current cache node to be refreshed and performing cache refreshing on a local cache of the cache node to be refreshed. The solution in this embodiment may be combined with the various alternatives in one or more of the embodiments described above. As shown in fig. 2, the method may include the steps of:
s210, determining a current refreshing cache node, and performing cache refreshing on a local cache of the current refreshing cache node.
Optionally, the current refresh cache node may be an application node in the cluster that currently needs to refresh the local cache.
S220, determining whether the local cache of the current cache refreshing node is refreshed successfully; if yes, go to S230; otherwise, return to execute S210.
In the embodiment of the present invention, after determining that the cache node is currently refreshed and performing cache refreshing on the local cache of the currently refreshed cache node, it may be further determined whether the local cache of the currently refreshed cache node is successfully refreshed. If the local cache of the current refreshing cache node is successfully refreshed, the node identification list can be obtained through the current refreshing cache node so as to further perform node identification traversal on the node identification list. If the local cache of the current refresh cache node fails to be refreshed, the operation of determining the current refresh cache node can be executed to re-determine the current refresh cache node, and the cache of the re-determined local cache of the current refresh cache node is refreshed.
And S230, obtaining a node identification list through the current refreshing cache node, and traversing the node identification list by the node identification.
The node identification list may be a list for storing node identifications. The node identifier may be used to identify a node, and may be, for example, an IP (Internet Protocol) address of the node, or a serial number of the node, which is not limited in the embodiment of the present invention. The node identification traversal may be a traversal of the node identifications in the node identification list.
In the embodiment of the present invention, after it is determined that the local cache of the current refresh cache node is successfully refreshed, the node identifier list may be further obtained by the current refresh cache node, so as to traverse the node identifiers in the node identifier list.
Optionally, the node identifier list is obtained by the current cache refreshing node, or the node identifier list is obtained by the cache notification service module of the current cache refreshing node.
Alternatively, the list of node identifications may be stored in a database. That is, obtaining the node identifier list by the current refresh cache node may include obtaining the node identifier list stored in the database by the current refresh cache node.
Optionally, before obtaining the node identifier list by currently refreshing the cache node, the method may further include: and acquiring the node identification of each starting node in the cluster, and storing the node identification of each starting node into a node identification list.
Wherein the initiating node may be a node that initiates operation. It will be appreciated that a node in a cluster may perform a cache flush on its local cache only after it has been booted.
Specifically, before the node identifier list is obtained by the current refresh cache node, the node identifier of each start node in the cluster may be obtained, so as to store the node identifier of each start node in the node identifier list.
S240, determining the cache node to be refreshed according to the node identification traversal result through the current cache node to be refreshed.
The node identifier traversal result may be a result obtained by traversing the node identifiers in the node identifier list. It is understood that the node identification traversal result may be a node identification of a certain node. Exemplarily, assuming that the node identifier list includes a node identifier of a node a and a node identifier of a node B, the node identifier list is traversed by the node identifiers for the first time, and an obtained node identifier traversal result may be the node identifier of the node a; next, the node identifier list is traversed by the node identifier, and the obtained node identifier traversal result may be the node identifier of the node B.
In the embodiment of the present invention, after the node identifier list is obtained by the current refresh cache node and the node identifier traversal is performed on the node identifier list, the cache node to be refreshed may be further determined by the current refresh cache node according to the node identifier traversal result. Optionally, the cache node to be refreshed may be an application node that needs to perform cache refreshing on the local cache except the current cache refreshing node in the cluster.
Optionally, determining, by the current cache refreshing node, a cache node to be refreshed according to the node identifier traversal result may include: determining the identifier of the cache node to be refreshed according to the node identifier traversal result by refreshing the cache node at present; determining a current refreshing cache node identifier of a current refreshing cache node through the current refreshing cache node; comparing the node identifier of the cache node to be refreshed with the current refreshing cache node identifier through the current refreshing cache node; and determining the cache node to be refreshed according to the cache node identifier to be refreshed under the condition that the comparison result of the node identifier is determined to be the target result through the current refresh cache node.
The cache node identifier to be refreshed may be a node identifier of a node that needs to be refreshed in the cache according to a node identifier traversal result. The current refresh cache node identification may be a node identification of the current refresh cache node. The node identification comparison may be a comparison of a plurality of node identifications. It is understood that by comparing node identifications of a plurality of nodes, it can be determined whether the plurality of node identifications are consistent. The node identifier comparison result may be a result of comparing a plurality of node identifiers, for example, a result of consistent node identifiers, or a result of inconsistent node identifiers. The target result may be a target value in the comparison of node identifications, for example, may be a result of inconsistent node identifications.
Specifically, the current refreshing cache node determines the identifier of the cache node to be refreshed according to the node identifier traversal result, determines the identifier of the current refreshing cache node, and compares the identifier of the cache node to be refreshed with the identifier of the current refreshing cache node, so that the cache node to be refreshed is determined according to the identifier of the cache node to be refreshed when the node identifier comparison result is the target result. It can be understood that, when the node identifier comparison result is that the node identifiers are inconsistent, that is, when the node identifier list is traversed by the node identifiers to obtain the cache node identifiers to be refreshed, the cache node to be refreshed is determined according to the cache node identifier to be refreshed when the cache node identifier to be refreshed is inconsistent with the current cache node identifier to be refreshed of the current cache node to be refreshed.
It can be further understood that, if the node identifier comparison result is that the node identifiers are consistent, that is, the node identifier to be refreshed obtained by traversing the node identifiers on the node identifier list is consistent with the current refresh cache node identifier of the current refresh cache node, which means that the node obtained by traversing the node identifiers on the node identifier list is the same as the current refresh cache node, and since the local cache of the current refresh cache node is successfully refreshed, it is not necessary to perform cache refreshing again on the local cache of the current refresh cache node, the node identifier traversal on the node identifier list can be performed in return to obtain the next cache node identifier to be refreshed.
And S250, sending a cache refreshing request to the cache node to be refreshed through the current cache refreshing node.
The cache refresh request may be a request for refreshing a local cache.
In the embodiment of the invention, after the cache node to be refreshed is determined according to the node identification traversal result by the current refresh cache node, a cache refresh request can be further sent to the cache node to be refreshed by the current refresh cache node.
Optionally, the cache notification service module of the current cache node to be refreshed may send a cache refresh request to the cache load service module of the cache node to be refreshed.
Optionally, the current cache refreshing node may call a cache refreshing interface of the cache node to be refreshed through an HTTP (Hyper Text Transfer Protocol) request, and send a cache refreshing request to the cache node to be refreshed.
S260, performing cache refreshing on the local cache of the cache node to be refreshed through the cache node to be refreshed according to the cache refreshing request.
In the embodiment of the present invention, after the cache refreshing request is sent to the cache node to be refreshed by the current cache refreshing node, the cache refreshing may be further performed on the local cache of the cache node to be refreshed by the cache node to be refreshed according to the cache refreshing request.
Optionally, the cache node to be refreshed performs cache refreshing on the local cache of the cache node to be refreshed according to the cache refreshing request, which may include reading, by the cache loading service module of the cache node to be refreshed, updated data from the database according to the cache refreshing request, and performing cache refreshing on the local cache of the cache node to be refreshed according to the updated data.
Optionally, after performing cache refresh on the local cache of the cache node to be refreshed, the method may further include: obtaining a cache refreshing result fed back by a cache node to be refreshed through a current refreshing cache node; when the cache refreshing result is that cache refreshing fails, returning to execute the operation of performing cache refreshing on the local cache of the cache node to be refreshed until the cache refreshing time reaches a preset time threshold; and under the condition that the cache refreshing result is that the cache refreshing is successful, returning to execute the operation of obtaining the node identification list through the current refreshing cache node and performing node identification traversal on the node identification list.
The cache refresh result may be a result of whether the local cache of the cache node to be refreshed is successfully refreshed. The number of cache refreshes may be the number of cache refreshes of the cache node to be refreshed. The preset threshold may be a preset threshold of the number of cache refreshes, for example, a preset maximum threshold of the number of cache refreshes.
Specifically, after the local cache of the cache node to be refreshed is refreshed, the cache node to be refreshed may generate a cache refresh result, and feed the cache refresh result back to the current refresh cache node, and the current refresh cache node further determines whether the cache refresh is successful after receiving the cache refresh result. If the cache refreshing fails, the operation of performing the cache refreshing on the local cache of the cache node to be refreshed can be returned to perform the cache refreshing on the local cache of the cache node to be refreshed again until the cache refreshing time reaches the preset time threshold. If the cache is successfully refreshed, the node identification list acquired by the current refreshing cache node can be returned to be executed so as to perform node identification traversal on the node identification list, and therefore the next cache node to be refreshed is determined according to the node identification traversal result.
According to the technical scheme, when the cache refreshing fails, the operation of performing the cache refreshing on the local cache of the cache node to be refreshed is returned, so that the cache refreshing success rate can be guaranteed, and the cache refreshing requirement of each node in the cluster can be fulfilled more efficiently and stably.
In a specific example of the embodiment of the present invention, fig. 3 is a schematic diagram illustrating an example of a local cache refreshing method provided in the second embodiment of the present invention, and fig. 4 is a flowchart illustrating an example of a local cache refreshing method provided in the second embodiment of the present invention, and as shown in fig. 3 and 4, the method may include: (1) When the application node is started, the node IP of the application node is stored in a node IP list of the database in a persistent mode. (2) The cache refresh interface of each node is exposed to the outside, and the cache refresh button is clicked at the management endpoint, so that the cache refresh request is forwarded to a certain application node (namely, the node B in fig. 3) by load balancing, and the application node can be determined as the current node (namely, the current cache refresh node). (3) After the current node receives the cache synchronization request, the cache loading service of the current node reads the latest data from the database and loads the latest data into the local memory of the current node, so that the current node realizes the cache refreshing operation. (4) And reading the node IP list from the database through the cache notification service of the current node, and traversing the IP list so as to call cache refresh interfaces of other nodes (namely cache nodes to be refreshed, node A or node C in the figure 3) through HTTP requests. (5) And after receiving the cache refreshing request, other nodes perform cache refreshing operation, immediately feed back a refreshing result to the current node after refreshing is completed, and if the operation fails, the current node continues to call the cache refreshing interface of the failed node and records the log until the maximum retry number is reached.
According to the technical scheme, a certain node receiving the cache refreshing request circularly calls the cache refreshing interfaces of other nodes, and the cache refreshing result is fed back to the notification node in real time, so that the local caches of all application nodes in the cluster mode can be refreshed synchronously; independent resources do not need to be deployed, cost is reduced, compatibility is better, system compactness is higher, and the number of nodes can be adjusted quickly; the failure retry mechanism ensures that the cache refreshing operation is successful, so that each node can be ensured to finish the cache refreshing operation, the reliability is higher, and the synchronous operation is recorded in a log mode, so that the audit positioning problem is facilitated; and the communication function of the cache refreshing notification is notified to other nodes by using the self resource cycle traversal of the application node, and the node initiating the cache refreshing notification is scheduled by load balance, so that the availability of the cache refreshing operation is ensured.
According to the technical scheme of the embodiment, the current refreshing cache node is determined, the local cache of the current refreshing cache node is subjected to cache refreshing, the node identification list is obtained through the current refreshing cache node when the local cache of the current refreshing cache node is successfully refreshed, node identification traversal is performed on the node identification list, the cache node to be refreshed is determined through the current refreshing cache node according to the node identification traversal result, and a cache refreshing request is sent to the cache node to be refreshed, so that the local cache of the cache node to be refreshed is subjected to cache refreshing through the cache node to be refreshed according to the cache refreshing request, and the current refreshing cache node is re-determined again when the local cache refreshing of the current refreshing cache node fails.
EXAMPLE III
Fig. 5 is a schematic diagram of a local cache refreshing apparatus according to a third embodiment of the present invention, and as shown in fig. 5, the apparatus includes: a first cache refresh module 510 and a second cache refresh module 520, wherein:
a first cache refreshing module 510, configured to determine a currently refreshed cache node, and perform cache refreshing on a local cache of the currently refreshed cache node;
a second cache refreshing module 520, configured to determine, by the current refresh cache node, a cache node to be refreshed under the condition that it is determined that the local cache of the current refresh cache node is successfully refreshed, so as to perform cache refresh on the local cache of the cache node to be refreshed.
According to the technical scheme, the current refreshing cache node is determined, the local cache of the current refreshing cache node is subjected to cache refreshing, and when the local cache of the current refreshing cache node is successfully refreshed, the cache node to be refreshed is determined through the current refreshing cache node, so that the local cache of the cache node to be refreshed is subjected to cache refreshing.
Optionally, the second cache refreshing module 520 may be specifically configured to: obtaining a node identification list by refreshing the cache node at present, and traversing the node identification list by the node identification; and determining the cache node to be refreshed according to the node identification traversal result by the current cache node refreshing.
Optionally, the second cache refresh module 520 may be further configured to: and acquiring the node identification of each starting node in the cluster, and storing the node identification of each starting node into a node identification list.
Optionally, the second cache refreshing module 520 may be further configured to: determining the identifier of the cache node to be refreshed according to the node identifier traversal result by refreshing the cache node at present; determining a current refreshing cache node identifier of a current refreshing cache node through the current refreshing cache node; comparing the node identifier of the cache node to be refreshed with the current cache node to be refreshed through the current cache node to be refreshed; and determining the cache node to be refreshed according to the cache node identifier to be refreshed under the condition of determining the node identifier comparison result as a target result through the current cache node to be refreshed.
Optionally, the second cache refreshing module 520 may be further specifically configured to: obtaining a cache refreshing result fed back by a cache node to be refreshed through a current refreshing cache node; when the cache refreshing result is that cache refreshing fails, returning to execute the operation of performing cache refreshing on the local cache of the cache node to be refreshed until the cache refreshing times reach a preset times threshold value; and under the condition that the cache refreshing result is that the cache refreshing is successful, returning to execute the operation of refreshing the cache node at present, acquiring a node identification list, and performing node identification traversal on the node identification list.
Optionally, the second cache refreshing module 520 may be further specifically configured to: sending a cache refreshing request to a cache node to be refreshed through a current refreshing cache node; and performing cache refreshing on the local cache of the cache node to be refreshed according to the cache refreshing request by the cache node to be refreshed.
Optionally, the local cache refreshing apparatus may be further configured to: and under the condition that the local cache of the current refresh cache node is determined to be failed to refresh, returning to execute the operation of determining the current refresh cache node.
The local cache refreshing device provided by the embodiment of the invention can execute the local cache refreshing method provided by any embodiment of the invention, and has the corresponding functional modules and beneficial effects of the execution method.
Example four
FIG. 6 illustrates a block diagram of an electronic device 10 that may be used to implement an embodiment of the invention. Electronic devices are intended to represent various forms of digital computers, such as laptops, desktops, workstations, personal digital assistants, servers, blade servers, mainframes, and other appropriate computers. The electronic device may also represent various forms of mobile devices, such as personal digital assistants, cellular phones, smart phones, wearable devices (e.g., helmets, glasses, watches, etc.), and other similar computing devices. The components shown herein, their connections and relationships, and their functions, are meant to be exemplary only, and are not meant to limit implementations of the inventions described and/or claimed herein.
As shown in fig. 6, the electronic device 10 includes at least one processor 11, and a memory communicatively connected to the at least one processor 11, such as a Read Only Memory (ROM) 12, a Random Access Memory (RAM) 13, and the like, wherein the memory stores a computer program executable by the at least one processor, and the processor 11 may perform various suitable actions and processes according to the computer program stored in the Read Only Memory (ROM) 12 or the computer program loaded from the storage unit 18 into the Random Access Memory (RAM) 13. In the RAM 13, various programs and data necessary for the operation of the electronic apparatus 10 may also be stored. The processor 11, the ROM 12, and the RAM 13 are connected to each other via a bus 14. An input/output (I/O) interface 15 is also connected to bus 14.
A number of components in the electronic device 10 are connected to the I/O interface 15, including: an input unit 16 such as a keyboard, a mouse, or the like; an output unit 17 such as various types of displays, speakers, and the like; a storage unit 18 such as a magnetic disk, an optical disk, or the like; and a communication unit 19 such as a network card, modem, wireless communication transceiver, etc. The communication unit 19 allows the electronic device 10 to exchange information/data with other devices via a computer network such as the internet and/or various telecommunication networks.
The processor 11 may be a variety of general and/or special purpose processing components having processing and computing capabilities. Some examples of processor 11 include, but are not limited to, a Central Processing Unit (CPU), a Graphics Processing Unit (GPU), various specialized Artificial Intelligence (AI) computing chips, various processors running machine learning model algorithms, a Digital Signal Processor (DSP), and any suitable processor, controller, microcontroller, or the like. Processor 11 performs the various methods and processes described above, such as the local cache flush method.
In some embodiments, the local cache refresh method may be implemented as a computer program tangibly embodied in a computer-readable storage medium, such as storage unit 18. In some embodiments, part or all of the computer program may be loaded and/or installed onto the electronic device 10 via the ROM 12 and/or the communication unit 19. When the computer program is loaded into RAM 13 and executed by processor 11, one or more steps of the local cache flush method described above may be performed. Alternatively, in other embodiments, the processor 11 may be configured to perform the local cache flush method by any other suitable means (e.g., by means of firmware).
Various implementations of the systems and techniques described here above may be implemented in digital electronic circuitry, integrated circuitry, field Programmable Gate Arrays (FPGAs), application Specific Integrated Circuits (ASICs), application Specific Standard Products (ASSPs), system on a chip (SOCs), load programmable logic devices (CPLDs), computer hardware, firmware, software, and/or combinations thereof. These various embodiments may include: implemented in one or more computer programs that are executable and/or interpretable on a programmable system including at least one programmable processor, which may be special or general purpose, receiving data and instructions from, and transmitting data and instructions to, a storage system, at least one input device, and at least one output device.
Computer programs for implementing the methods of the present invention can be written in any combination of one or more programming languages. These computer programs may be provided to a processor of a general purpose computer, special purpose computer, or other programmable data processing apparatus, such that the computer programs, when executed by the processor, cause the functions/acts specified in the flowchart and/or block diagram block or blocks to be performed. A computer program can execute entirely on a machine, partly on the machine, as a stand-alone software package, partly on the machine and partly on a remote machine or entirely on the remote machine or server.
In the context of the present invention, a computer-readable storage medium may be a tangible medium that can contain, or store a computer program for use by or in connection with an instruction execution system, apparatus, or device. A computer readable storage medium may include, but is not limited to, an electronic, magnetic, optical, electromagnetic, infrared, or semiconductor system, apparatus, or device, or any suitable combination of the foregoing. Alternatively, the computer readable storage medium may be a machine readable signal medium. More specific examples of a machine-readable storage medium would include an electrical connection based on one or more wires, a portable computer diskette, a hard disk, a Random Access Memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), an optical fiber, a compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any suitable combination of the foregoing.
To provide for interaction with a user, the systems and techniques described here can be implemented on an electronic device having: a display device (e.g., a CRT (cathode ray tube) or LCD (liquid crystal display) monitor) for displaying information to a user; and a keyboard and a pointing device (e.g., a mouse or a trackball) by which a user can provide input to the electronic device. Other kinds of devices may also be used to provide for interaction with a user; for example, feedback provided to the user can be any form of sensory feedback (e.g., visual feedback, auditory feedback, or tactile feedback); and input from the user may be received in any form, including acoustic, speech, or tactile input.
The systems and techniques described here can be implemented in a computing system that includes a back-end component (e.g., as a data server), or that includes a middleware component (e.g., an application server), or that includes a front-end component (e.g., a user computer having a graphical user interface or a web browser through which a user can interact with an implementation of the systems and techniques described here), or any combination of such back-end, middleware, or front-end components. The components of the system can be interconnected by any form or medium of digital data communication (e.g., a communication network). Examples of communication networks include: local Area Networks (LANs), wide Area Networks (WANs), blockchain networks, and the Internet.
The computing system may include clients and servers. A client and server are generally remote from each other and typically interact through a communication network. The relationship of client and server arises by virtue of computer programs running on the respective computers and having a client-server relationship to each other. The server can be a cloud server, also called a cloud computing server or a cloud host, and is a host product in a cloud computing service system, so that the defects of high management difficulty and weak service expansibility in the traditional physical host and VPS service are overcome.
It should be understood that various forms of the flows shown above may be used, with steps reordered, added, or deleted. For example, the steps described in the present invention may be executed in parallel, sequentially, or in different orders, and are not limited herein as long as the desired result of the technical solution of the present invention can be achieved.
The above-described embodiments should not be construed as limiting the scope of the invention. It should be understood by those skilled in the art that various modifications, combinations, sub-combinations and substitutions may be made in accordance with design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (10)

1. A local cache refreshing method is characterized by comprising the following steps:
determining a current refreshing cache node, and performing cache refreshing on a local cache of the current refreshing cache node;
and under the condition that the local cache of the current cache refreshing node is successfully refreshed, determining a cache node to be refreshed through the current cache refreshing node so as to refresh the local cache of the cache node to be refreshed.
2. The method according to claim 1, wherein the determining, by the currently refreshed cache node, a cache node to be refreshed comprises:
obtaining a node identification list through the current refreshing cache node, and traversing the node identification list by the node identification;
and determining the cache node to be refreshed according to a node identification traversal result by the current cache node to be refreshed.
3. The method of claim 2, wherein prior to said obtaining a list of node identifications by said currently refreshing a cache node, further comprising:
and acquiring the node identification of each starting node in the cluster, and storing the node identification of each starting node into the node identification list.
4. The method according to claim 2, wherein the determining, by the current refresh cache node, the cache node to be refreshed according to a node identification traversal result comprises:
determining the identifier of the cache node to be refreshed according to the node identifier traversal result through the current refresh cache node;
determining a current refreshing cache node identifier of the current refreshing cache node through the current refreshing cache node;
comparing the node identifier of the cache node to be refreshed with the current refreshing cache node identifier through the current refreshing cache node;
and determining the cache node to be refreshed according to the cache node identifier to be refreshed under the condition that the comparison result of the node identifier is determined to be the target result through the current cache node to be refreshed.
5. The method according to claim 2, further comprising, after the cache refreshing the local cache of the cache node to be refreshed:
obtaining a cache refreshing result fed back by the cache node to be refreshed through the current cache refreshing node;
returning to execute the operation of performing cache refreshing on the local cache of the cache node to be refreshed under the condition that the cache refreshing result is cache refreshing failure until the cache refreshing times reach a preset time threshold value;
and under the condition that the cache refreshing result is that the cache refreshing is successful, returning to execute the operation of obtaining a node identification list through the current refreshing cache node and performing node identification traversal on the node identification list.
6. The method according to claim 1, wherein the performing cache refresh on the local cache of the cache node to be refreshed comprises:
sending a cache refreshing request to the cache node to be refreshed through the current cache refreshing node;
and performing cache refreshing on the local cache of the cache node to be refreshed through the cache node to be refreshed according to the cache refreshing request.
7. The method of claim 1, further comprising:
and under the condition that the local cache of the current cache refreshing node is determined to be failed to refresh, returning to execute the operation of determining the current cache refreshing node.
8. A local cache refreshing apparatus, comprising:
the first cache refreshing module is used for determining a current refreshing cache node and refreshing a local cache of the current refreshing cache node;
and the second cache refreshing module is used for determining the cache node to be refreshed through the current refreshing cache node under the condition that the local cache of the current refreshing cache node is successfully refreshed, so as to perform cache refreshing on the local cache of the cache node to be refreshed.
9. An electronic device, characterized in that the electronic device comprises:
at least one processor; and
a memory communicatively coupled to the at least one processor; wherein, the first and the second end of the pipe are connected with each other,
the memory stores a computer program executable by the at least one processor to enable the at least one processor to perform the local cache refresh method of any one of claims 1-7.
10. A computer-readable storage medium having stored thereon computer instructions for causing a processor, when executed, to implement the local cache refresh method of any one of claims 1-7.
CN202211310767.5A 2022-10-25 2022-10-25 Local cache refreshing method and device, electronic equipment and storage medium Pending CN115665245A (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN202211310767.5A CN115665245A (en) 2022-10-25 2022-10-25 Local cache refreshing method and device, electronic equipment and storage medium

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN202211310767.5A CN115665245A (en) 2022-10-25 2022-10-25 Local cache refreshing method and device, electronic equipment and storage medium

Publications (1)

Publication Number Publication Date
CN115665245A true CN115665245A (en) 2023-01-31

Family

ID=84991079

Family Applications (1)

Application Number Title Priority Date Filing Date
CN202211310767.5A Pending CN115665245A (en) 2022-10-25 2022-10-25 Local cache refreshing method and device, electronic equipment and storage medium

Country Status (1)

Country Link
CN (1) CN115665245A (en)

Similar Documents

Publication Publication Date Title
US11379461B2 (en) Multi-master architectures for distributed databases
CN109783151B (en) Method and device for rule change
CN113094430B (en) Data processing method, device, equipment and storage medium
CN114064414A (en) High-availability cluster state monitoring method and system
CN115580645A (en) Service switching method and device, electronic equipment and storage medium
US9996591B2 (en) System and method for implementing a database in a heterogeneous cluster
US10083201B2 (en) System for maintaining consistency across a decentralized database cluster and method therefor
CN113760638A (en) Log service method and device based on kubernets cluster
CN115470303B (en) Database access method, device, system, equipment and readable storage medium
CN112052104A (en) Message queue management method based on multi-computer-room realization and electronic equipment
CN115665245A (en) Local cache refreshing method and device, electronic equipment and storage medium
CN115510036A (en) Data migration method, device, equipment and storage medium
CN113360689B (en) Image retrieval system, method, related device and computer program product
CN114691781A (en) Data synchronization method, system, device, equipment and medium
CN114610719A (en) Cross-cluster data processing method and device, electronic equipment and storage medium
CN115174447B (en) Network communication method, device, system, equipment and storage medium
CN117725115A (en) Database sequence processing method, device, equipment and storage medium
CN117251285A (en) Dynamic loading method, device, equipment and storage medium of configuration information
CN115756855A (en) Cluster switching method, device, terminal and storage medium
CN114615273B (en) Data transmission method, device and equipment based on load balancing system
CN115712679A (en) Data processing system, method, electronic equipment and storage medium
CN115665240A (en) Proxy service adding method, device, electronic equipment and storage medium
CN114637738A (en) Data visibility judgment method and device, database node and medium
CN116614357A (en) Configuration information issuing method and device, electronic equipment and storage medium
CN117093274A (en) Application running stack analysis method, device, equipment and 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