Method, device, apparatus and storage medium for refreshing cache

By identifying and updating the content of other cached objects that have data dependencies on them when refreshing a cached object, the problem of cache inconsistency under the dependency relationship between cached objects is solved, and the accuracy and consistency of cached objects are achieved.

CN112699148BActive Publication Date: 2025-11-21BEIJING SANKUAI ONLINE TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202011624951.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2020-12-31
Publication Date
2025-11-21
Estimated Expiration
2040-12-31

AI Technical Summary

Technical Problem

When there are dependencies between cached objects, using an isolation approach to manage them can lead to other cached objects not being refreshed, resulting in inaccurate caching.

Method used

When refreshing the first cache object, identify the second cache object that has a data dependency relationship with it, and update the cache content of the first and second cache objects at the same time to ensure that the dependent cache objects remain consistent.

Benefits of technology

By updating the cached content of related cached objects simultaneously, the problem of inaccurate second cached objects caused by only refreshing the first cached object is avoided, thus ensuring the accuracy of cached objects.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN112699148B_ABST
    Figure CN112699148B_ABST
Patent Text Reader

Abstract

The application discloses a cache refreshing method, device, equipment and storage medium, and belongs to the computer technical field. The method comprises the following steps: receiving a refreshing instruction for a first cache object in a cache device, wherein the refreshing instruction indicates updating cache content in the first cache object; in response to the refreshing instruction, determining a second cache object in the cache device, wherein the second cache object is isolated from the first cache object and has a data dependency relationship; and updating the cache content in the first cache object and the second cache object. The method updates the cache content in the second cache object which has the data dependency relationship while updating the cache content in the first cache object, performs refreshing management on the cache objects on the cache device from the content level, and ensures the accuracy of other cache objects which have the data dependency relationship with the first cache object after refreshing the first cache object.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] This application relates to the field of computer technology, and in particular to a method, apparatus, device and storage medium for refreshing a cache. Background Technology

[0002] With the popularization of the Internet, content information is becoming more and more complex, and the number of users and access volume is also increasing. However, the number of requests that a database can accept per second is limited. Therefore, in order to improve data throughput, a cache, a storage device that provides high-speed access, has been introduced.

[0003] Generally, cached objects are managed in isolation. The cache manager implements independent refresh control for each cached object. For example, if there are cached objects A and B in the cache, the cache manager refreshes cached objects A and B separately.

[0004] However, if there are dependencies between cached objects, then using isolation management means that if one cached object is refreshed, other cached objects with dependencies will not be refreshed, which will lead to inaccuracies in the other cached objects. For example, if cached object A caches the operation variables of cached object B, and cached object A is refreshed independently, the operation variables will change, but cached object B will still be calculated using the operation variables before the refresh, then cached object B will be incorrect. Summary of the Invention

[0005] This application provides a method, apparatus, device, and storage medium for refreshing a cache. While refreshing the cached content in a first cache object, it also refreshes the cached content in a second cache object with which it has a data dependency. This content-level refresh management of cache objects on the cache device ensures the accuracy of other cache objects with data dependencies after one cache object is refreshed. The technical solution is as follows:

[0006] According to one aspect of this application, a method for refreshing a cache is provided, the method comprising:

[0007] Receive a refresh instruction for a first cache object in a cache device, the refresh instruction indicating that the cache content in the first cache object be updated;

[0008] In response to the refresh command, a second cache object in the cache device is determined, wherein the second cache object is cached in isolation from the first cache object and has a data dependency relationship;

[0009] Update the cached content in the first cache object and the second cache object.

[0010] According to another aspect of this application, an apparatus for refreshing a cache is provided, the apparatus comprising:

[0011] The receiving module is configured to receive a refresh instruction for a first cache object in the caching device, the refresh instruction indicating that the cache content in the first cache object be updated;

[0012] The determination module is used to determine a second cache object in the cache device in response to the refresh instruction. The second cache object is isolated from the first cache object and has a data dependency relationship.

[0013] The update module is used to update the cached content in the first cache object and the second cache object.

[0014] According to another aspect of this application, a computer device is provided, the computer device comprising: a processor and a memory, the memory storing a computer program, the computer program being loaded and executed by the processor to implement the cache refresh method as described in the preceding aspect.

[0015] According to another aspect of this application, a computer-readable storage medium is provided, wherein a computer program is stored therein, the computer program being loaded and executed by a processor to implement the method of refreshing the cache as described in the preceding aspect.

[0016] According to another aspect of this application, a computer program product is provided, the computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium, and the processor executes the computer instructions, causing the computer device to perform the cache refresh method as described in the preceding aspect.

[0017] The beneficial effects of the technical solutions provided in this application include at least the following:

[0018] During the refresh process of the isolated cache, after receiving a refresh instruction for the first cache object in the cache device, the second cache object with data dependency relationship with the first cache object is first identified. Then, the content level of the first cache object and the second cache object is updated. That is, while refreshing the cache content of the first cache object, the cache content of the second cache object with data dependency relationship with it is also refreshed. This ensures the accuracy of the second cache object with data dependency relationship after the first cache object is refreshed, and avoids the problem of inaccurate cache content in the second cache object caused by only refreshing the first cache object. Attached Figure Description

[0019] To more clearly illustrate the technical solutions in the embodiments of this application, the accompanying drawings used in the description of the embodiments will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this application. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.

[0020] Figure 1 A flowchart illustrating a caching method for a cache object provided in an exemplary embodiment of this application is shown;

[0021] Figure 2 This invention provides a schematic diagram of the topology of a cache object according to an exemplary embodiment of the present application.

[0022] Figure 3 A schematic diagram illustrating a circular dependency provided in an exemplary embodiment of this application is shown;

[0023] Figure 4 A flowchart illustrating a method for refreshing a cache provided in an exemplary embodiment of this application is shown;

[0024] Figure 5 A flowchart illustrating a method for refreshing a cache provided in another exemplary embodiment of this application is shown;

[0025] Figure 6 A block diagram of an apparatus for refreshing a cache, provided in an exemplary embodiment of this application, is shown.

[0026] Figure 7 A schematic diagram of the structure of a computer device provided in an exemplary embodiment of this application is shown. Detailed Implementation

[0027] To make the objectives, technical solutions, and advantages of this application clearer, the embodiments of this application will be described in further detail below with reference to the accompanying drawings.

[0028] First, let me introduce some of the terms used in this application:

[0029] A cache device, also known as a cache, is a type of high-speed memory that enables rapid data exchange. Broadly speaking, any structure located between two hardware / software systems with significantly different speeds, used to coordinate the differences in data transfer rates, can be called a cache. For example, when the Central Processing Unit (CPU) needs to read data, it first searches the CPU cache. If found, it reads the data immediately and sends it to the CPU for processing; if not found, it reads the data from the relatively slower main memory and sends it to the CPU. Simultaneously, the data block containing this data is loaded into the cache, allowing subsequent reads of the entire data block to be performed from the cache without needing to access main memory again. The cached objects on a cache device can include various types of data, such as models, features, and operators.

[0030] Data dependency refers to the mutual constraints between data, a semantic manifestation. For example, data dependency can include functional dependency and multivalued dependency. Functional dependency can be interpreted as: when one set of attributes determines another set of attributes, the other set of attributes is said to be dependent on the first set. Multivalued dependency can be interpreted as: some attribute values ​​have no direct relationship but have indirect relationships; this indirect relationship is called multivalued dependency. In functional dependency, whether X and Y have a functional dependency depends only on the two sets of attributes X and Y, regardless of other attributes. However, in multivalued dependency, whether X and Y have a multivalued dependency also depends on attribute Z.

[0031] Caches can be applied in any scenario where data exchange occurs. For example, in a database system, data in the database is cached, and when querying data in the database system, the first lookup is made in the cache. Similarly, on a terminal, data required for application execution is cached in the CPU cache, and when the CPU needs certain data for computation, it first retrieves it from the CPU cache.

[0032] Generally, cache refresh management typically employs an isolated refresh management approach, with each cache object undergoing independent refresh control. However, in cascaded caching scenarios (i.e., where data dependencies exist), the various cache objects are interdependent. If the isolated refresh management approach continues to be used, differences in the underlying data among the various cache objects will arise, leading to cache inconsistency. Therefore, this application provides a method for refreshing the cache to address the aforementioned technical problems.

[0033] like Figure 1 The diagram illustrates a flowchart of a caching method for a cached object provided in an exemplary embodiment of this application. The method is applied in a computer device and includes:

[0034] Step 101, Begin.

[0035] Step 102: Register the cache during the system startup phase.

[0036] During system startup, the computer device registers the data that needs to be cached with the cache manager, which then manages the data in a unified manner.

[0037] In other words, in response to the system's startup command, the computer device registers the data to be cached through the cache manager, obtaining at least two cache objects. For example, the computer device reads data from an external storage device of the cache device, registers it in the cache manager, and obtains at least two cache objects; for example, the external storage device could be a database or memory.

[0038] For example, taking a database system as an example, during the database system startup phase, the data stored in the database is registered with the cache manager, resulting in at least two cache objects that have been registered.

[0039] Step 103: Calculate the dependency path using the cache manager.

[0040] There is a data dependency relationship between at least two cached objects; the computer device calls the cache manager, which calculates the dependency path based on the data dependency relationship between the at least two cached objects, and then generates at least one topology structure of the at least two cached objects based on the dependency path.

[0041] For example, such as Figure 2 The cache manager registers 15 cache objects and calculates 9 dependency paths for these 15 objects, generating 5 topologies from these 9 dependency paths. Within each topology, cache objects are abstracted as cache nodes for caching. For example, the topologies can be mesh-like (e.g., the topology containing cache node 6), tree-like (e.g., the topology containing cache node 0), or ring-like (e.g., the topology containing cache node 1). Cache nodes 3, 4, and 5 have a circular dependency relationship, also known as a circular dependency relationship. For example, root node 12 is the lowest-level cache object in the dependency relationship (i.e., the beginning of the dependency path).

[0042] Examples of cyclic dependencies are provided, such as Figure 3The dependency between model cache 21 and feature cache 22 is that model computation includes features. The dependency between feature cache 22 and operator cache 23 is that features derive and call operators. The dependency between operator cache 23 and model cache 21 is that operators nest model scenarios. That is, model cache 21 depends on operator cache 23, feature cache 22 depends on model cache 21, and operator cache 23 depends on model cache 21. The three form a circular dependency.

[0043] Step 104, End.

[0044] In summary, the caching method for cached objects provided in this embodiment caches cached objects in a topological manner. During the cache refresh process, it can quickly find cached objects with dependencies, thereby realizing the cache refresh method provided in this application and improving the efficiency of cache refresh.

[0045] Figure 4 A flowchart illustrating an exemplary embodiment of this application provides a method for refreshing a cache, the method being applied in a computer device, the method comprising:

[0046] Step 201: Receive a refresh instruction for the first cached object in the cache device.

[0047] The computer device receives a refresh instruction for a first cached object in a cache device, the refresh instruction instructing the updating of the cached content in the first cached object. For example, the refresh instruction may be triggered by a user operation on the computer device, such as the computer device receiving a data refresh operation from an input device, triggering the refresh instruction for the first cached object in the cache device; or the refresh instruction may be triggered automatically and periodically on the computer device.

[0048] Step 202: In response to the refresh command, a second cache object in the cache device is determined. The second cache object is isolated from the first cache object and has a data dependency relationship.

[0049] For example, the cache manager of a computer device has a correspondence between a first cache object and a second cache object. Based on the above correspondence, the cache manager queries the second cache object that has a direct or indirect dependency relationship with the first cache object.

[0050] For example, refer to Figure 1In the optional embodiment shown, the cache manager abstracts cache objects into cache nodes and constructs a topology based on the cache nodes; optionally, in response to a refresh command, the terminal determines the first cache node of the first cache object; and determines the second cache node located in the same topology as the first cache node, on which the second cache node caches the second cache object; wherein, the above topology is constructed based on the data dependency relationship between cache objects.

[0051] For example, to determine the second cache node, the cache manager calls the reachability analysis algorithm to calculate the dependency path of the first cache node in the topology, and determines the second cache node by other cache nodes on the dependency path of the first cache node.

[0052] For example, such as Figure 2 When cache node 1 is refreshed, the cache manager can use a reachability analysis algorithm to determine cache nodes 2, 3, 4, and 5 from the topology. There is a direct dependency between cache node 2 and cache node 1, and an indirect dependency between cache node 1 and cache nodes 3, 4, and 5. When cache node 6 is refreshed, the cache manager can use a reachability analysis algorithm to determine cache nodes 7, 8, and 9 from the topology. There is a direct dependency between cache node 7 and cache node 6, and an indirect dependency between cache node 6 and cache nodes 8 and 9.

[0053] Step 203: Update the cached content in the first cache object and the second cache object.

[0054] The computer device updates the cached content in the first cache object and the second cache object on the cache device based on the cached update content of the first cache object.

[0055] For example, the computer device updates part or all of the cached content of the first cache object based on the cached update content of the first cache object through the cache manager, and updates the cached content of the second cache object that has a data dependency relationship with the cached update content.

[0056] In summary, the cache refresh method provided in this embodiment, during the refresh process of isolated cache, after receiving a refresh instruction for a first cache object in the cache device, firstly identifies a second cache object that has a data dependency relationship with the first cache object, and then updates the content level of the first and second cache objects. That is, while refreshing the cache content of the first cache object, the cache content of the second cache object that has a data dependency relationship with it is also refreshed, ensuring the accuracy of the second cache object that has a data dependency relationship with it after the first cache object is refreshed, and avoiding the problem of inaccurate cache content in the second cache object caused by only refreshing the first cache object.

[0057] In some embodiments, when there is a circular dependency between cached objects, to avoid the problem of cascading cache refreshes, the computer device directly retrieves data from the external storage device corresponding to the cache to update the first cached data and the second cached data as a whole. Figure 5 The diagram illustrates a flowchart of a method for refreshing a cache provided in another exemplary embodiment of this application, the method being applied in a computer device, the method comprising:

[0058] Step 301: Receive a refresh instruction for the first cached object in the cache device.

[0059] Step 302: In response to the refresh command, determine the first cache node of the first cache object.

[0060] Step 303: Identify the second cache node located in the same topology as the first cache node. The second cache node caches the second cache object. The topology is constructed based on the data dependencies between the cache objects.

[0061] Please refer to steps 301 to 303 above. Figure 4 Steps 201 to 202 in the illustrated embodiment will not be described again here.

[0062] Step 304: When there is no ring topology in the topology, replace the original cache content in the first cache object with the cache update content, and update the cache content in the second cache object that has a data dependency relationship with the original cache content.

[0063] Optionally, the above-mentioned ring topology includes at least one of the following: a first ring topology formed between the first cache node and the second cache node; and a second ring topology formed between at least two second cache nodes.

[0064] When neither the first circular topology nor the second circular topology exists in the topology, the computer device determines that there is no circular dependency between the first cache object and the second cache object, and that there is also no circular dependency between at least two cache objects.

[0065] When there are no circular dependencies on the dependency path of the first cache node, the computer device replaces the original cached content in the first cache object with the updated cached content, and updates the cached content in the second cache object that has a data dependency relationship with the original cached content. The original cached content is the content in the first cache object that corresponds to the updated cached content before the refresh.

[0066] For example, in the topology of a cascaded cache, each cache node has an update priority, with the root node having the highest priority, and the priority of cache nodes decreasing sequentially in the direction away from the root node; in the process of updating the first cache object and the second cache object, the first cache object is defined as the root node, and the cache content is updated starting from the first cache node, and the cache content on the second cache node that has a data dependency relationship with the original cache content is updated sequentially according to the priority order.

[0067] Step 305: When a ring topology exists in the topology, read all the contents corresponding to the first cache object and the second cache object from the external storage device of the cache device respectively, and replace and update the cache contents of the first cache object and the second cache object based on all the contents.

[0068] When a first circular topology exists in the topology, the computer device determines that there is a circular dependency between the first cache object and some of the second cache objects, or that there is a circular dependency between the first cache object and all of the second cache objects; when a second circular topology exists in the topology, the computer device determines that there is a circular dependency between at least two second cache objects.

[0069] When at least one of a first ring topology and a second ring topology exists on the dependency path where the first cache node is located, the computer device reads all the content corresponding to the first cache object from the external storage device of the cache device, and performs a complete replacement and update of the cache content of the first cache object based on all the content corresponding to the first cache object. It also reads all the content corresponding to the second cache object from the external storage device and performs a complete replacement and update of the cache content of the second cache object based on all the content corresponding to the second cache object.

[0070] For example, the contents of the first cache object and the second cache object mentioned above can also be obtained from the persistence layer. The persistence layer generally refers to the data access layer, whose main function is to handle database access.

[0071] In summary, the cache refresh method provided in this embodiment employs different refresh techniques for cascaded caches with and without circular dependencies. For cascaded caches without circular dependencies, the cached content within the cache object is refreshed, allowing for rapid refresh of both the first and second cache objects. For cascaded caches with circular dependencies, when a circular dependency exists between cache objects, the updated data is directly read from the external storage device. Then, based on the updated data, the cached content of both the first and second cache objects is completely replaced and updated to avoid the problem of circular cache refresh while ensuring the correctness of the refreshed cached content of both the first and second cache objects.

[0072] Figure 6 The diagram illustrates a block diagram of an apparatus for refreshing a cache according to an exemplary embodiment of this application. This apparatus can be implemented as part or all of a terminal or server through software, hardware, or a combination of both. The apparatus includes:

[0073] The receiving module 401 is configured to receive a refresh instruction for a first cache object in the caching device, the refresh instruction indicating that the cache content in the first cache object be updated;

[0074] The determination module 402 is used to determine a second cache object in the cache device in response to the refresh instruction. The second cache object is isolated from the first cache object and has a data dependency relationship.

[0075] The update module 403 is used to update the cached content in the first cache object and the second cache object.

[0076] In some embodiments, the determining module 402 is configured to:

[0077] In response to the refresh command, the first cache node of the first cache object is determined;

[0078] A second cache node is identified that is located in the same topology as the first cache node, and the second cache node caches the second cache object; wherein the topology is constructed based on the data dependencies between cache objects.

[0079] In some embodiments, the update module 403 is configured to:

[0080] Based on the cache update content of the first cache object, the cache content in the first cache object and the second cache object on the cache device is updated.

[0081] In some embodiments, the update module 403 is configured to:

[0082] When there is no ring topology in the topology, the original cache content in the first cache object is replaced with the cache update content;

[0083] Update the cached content in the second cache object that has the data dependency relationship with the original cached content;

[0084] The original cached content is the content in the first cache object before the refresh that corresponds to the cache update content.

[0085] In some embodiments, the update module 403 is configured to:

[0086] When a ring topology exists in the topology, all contents corresponding to the first cache object and the second cache object are read from the external storage device of the cache device, respectively. The all contents include the contents updated based on the cache update content.

[0087] Based on all the above content, the cache content of the first cache object and the second cache object are replaced and updated respectively.

[0088] In some embodiments, the ring topology includes at least one of the following:

[0089] The first ring topology formed between the first cache node and the second cache node;

[0090] A second ring topology is formed between at least two of the second cache nodes.

[0091] In some embodiments, the apparatus further includes: a registration module 404, a calculation module 405, and a generation module 406;

[0092] The registration module 404 is used to register the data to be cached through the cache manager in response to the system's startup command, thereby obtaining at least two cache objects;

[0093] The calculation module 405 is used to calculate the dependency path based on the data dependency relationship between the at least two cached objects;

[0094] The generation module 406 is used to generate at least one topology structure corresponding to the at least two cache objects based on the dependency path.

[0095] In summary, the cache refresh device provided in this embodiment, during the refresh process of isolated cache, after receiving a refresh instruction for a first cache object in the cache device, first determines a second cache object that has a data dependency relationship with the first cache object, and then updates the content level of the first cache object and the second cache object. That is, while refreshing the cache content of the first cache object, it also refreshes the cache content of the second cache object that has a data dependency relationship with it, ensuring the accuracy of the second cache object that has a data dependency relationship with it after the first cache object is refreshed, and avoiding the problem of inaccurate cache content in the second cache object caused by only refreshing the first cache object.

[0096] Figure 7 This illustration shows a schematic diagram of a computer device provided in an exemplary embodiment of this application. The computer device can be a device that performs the cache refresh method provided in this application; the computer device can be a terminal or a server. Specifically:

[0097] Computer device 500 includes a central processing unit (CPU) 501, a system memory 504 including random access memory (RAM) 502 and read-only memory (ROM) 503, and a system bus 505 connecting the system memory 504 and the CPU 501. Computer device 500 also includes a basic input / output system (I / O system) 506 that facilitates information transfer between various devices within the computer, and a mass storage device 507 for storing the operating system 513, application programs 514, and other program modules 515.

[0098] The basic input / output system 506 includes a display 508 for displaying information and an input device 509 for user input, such as a mouse or keyboard. Both the display 508 and the input device 509 are connected to the central processing unit 501 via an input / output controller 510 connected to the system bus 505. The basic input / output system 506 may also include the input / output controller 510 for receiving and processing input from multiple other devices such as a keyboard, mouse, or electronic stylus. Similarly, the input / output controller 510 also provides output to a display screen, printer, or other types of output devices.

[0099] Mass storage device 507 is connected to central processing unit 501 via a mass storage controller (not shown) connected to system bus 505. Mass storage device 507 and its associated computer-readable media provide non-volatile storage for computer device 500. That is, mass storage device 507 may include computer-readable media (not shown) such as hard disk or compact disc read-only memory (CD-ROM) drive.

[0100] Computer-readable media can include computer storage media and communication media. Computer storage media include volatile and non-volatile, removable and non-removable media implemented using any method or technology for storing information such as computer-readable instructions, data structures, program modules, or other data. Computer storage media include RAM, ROM, erasable programmable read-only memory (EPROM), electrically erasable programmable read-only memory (EEPROM), flash memory or other solid-state storage technologies, CD-ROM, digital versatile optical disc (DVD), or solid-state drives (SSD), other optical storage, magnetic tape cassettes, magnetic tape, disk storage, or other magnetic storage devices. Random access memory can include resistive random access memory (ReRAM) and dynamic random access memory (DRAM). Of course, those skilled in the art will recognize that computer storage media are not limited to the above-mentioned types. The system memory 504 and the mass storage device 507 mentioned above can be collectively referred to as memory.

[0101] According to various embodiments of this application, the computer device 500 can also connect to a remote computer on a network, such as the Internet, for operation. That is, the computer device 500 can connect to a network 512 via a network interface unit 511 connected to the system bus 505, or it can use the network interface unit 511 to connect to other types of networks or remote computer systems (not shown). The computer device 500 can also communicate via NFC (not shown).

[0102] The aforementioned memory also includes one or more programs, which are stored in the memory and configured to be executed by the CPU.

[0103] In an optional embodiment, a computer device is provided, the computer device including a processor and a memory, the memory storing at least one instruction, at least one program, code set or instruction set, the at least one instruction, at least one program, code set or instruction set being loaded and executed by the processor to implement the cache refresh method as described above.

[0104] In an alternative embodiment, a computer-readable storage medium is provided that stores at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the cache refresh method as described above.

[0105] Optionally, the computer-readable storage medium may include: read-only memory (ROM), random access memory (RAM), solid-state drives (SSDs), or optical discs, etc. The random access memory may include resistive random access memory (ReRAM) and dynamic random access memory (DRAM). The sequence numbers of the embodiments in this application are merely descriptive and do not represent the superiority or inferiority of the embodiments.

[0106] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0107] This application also provides a computer-readable storage medium storing at least one instruction, at least one program, code set, or instruction set, wherein the at least one instruction, at least one program, code set, or instruction set is loaded and executed by a processor to implement the cache refresh method provided in the above-described method embodiments.

[0108] This application also provides a computer program product including computer instructions stored in a computer-readable storage medium. A processor of a computer device reads the computer instructions from the computer-readable storage medium and executes the computer instructions, causing the computer device to perform the cache refresh method as described above.

[0109] It should be understood that "multiple" as used in this article refers to two or more. "And / or" describes the relationship between related objects, indicating that three relationships can exist. For example, A and / or B can represent: A alone, A and B simultaneously, or B alone. The character " / " generally indicates that the preceding and following related objects have an "or" relationship.

[0110] Those skilled in the art will understand that all or part of the steps of the above embodiments can be implemented by hardware or by a program instructing related hardware. The program can be stored in a computer-readable storage medium, such as a read-only memory, a disk, or an optical disk.

[0111] The above description is merely an optional embodiment of this application and is not intended to limit this application. Any modifications, equivalent substitutions, improvements, etc., made within the spirit and principles of this application should be included within the protection scope of this application.

Claims

1. A method for refreshing a cache, characterized in that, The method includes: Receive a refresh instruction for a first cache object in a cache device, the refresh instruction indicating that the cache content in the first cache object be updated; In response to the refresh command, the first cache node of the first cache object is determined; The reachability analysis algorithm is invoked to calculate the dependency path of the first cache node in the topology, which is constructed based on the data dependency relationship between cache objects; other cache nodes on the dependency path are identified as second cache nodes, and second cache nodes cache second cache objects, which are cached in isolation from the first cache object and have a data dependency relationship. Based on the cache update content of the first cache object, the cache content in the first cache object and the second cache object on the cache device is updated, including: when a ring topology exists in the topology, reading all the content corresponding to the first cache object and the second cache object from the external storage device of the cache device, the all content including the content updated based on the cache update content, the all content being obtained from the persistence layer; and replacing and updating the cache content of the first cache object and the second cache object based on the all content. The ring topology includes a first ring topology or a second ring topology. When the ring topology is the first ring topology, there is a circular dependency between the first cache object and some or all of the second cache objects. When the ring topology is the second ring topology, there is a circular dependency between at least two second cache objects.

2. The method according to claim 1, characterized in that, The step of updating the cached content in the first cache object and the second cache object on the cache device based on the cache update content of the first cache object includes: When there is no ring topology in the topology, the original cache content in the first cache object is replaced with the cache update content; Update the cached content in the second cache object that has the data dependency relationship with the original cached content; The original cached content is the content in the first cache object before the refresh that corresponds to the cache update content.

3. The method according to claim 1 or 2, characterized in that, The ring topology includes at least one of the following: The first ring topology formed between the first cache node and the second cache node; A second ring topology is formed between at least two of the second cache nodes.

4. The method according to claim 1, characterized in that, Before receiving the refresh instruction for the first cache object in the cache device, the method further includes: In response to the system's startup command, the cache manager registers the data to be cached, resulting in at least two cache objects; The dependency path is calculated based on the data dependency relationship between the at least two cached objects; At least one topology structure corresponding to the at least two cached objects is generated based on the dependency path.

5. An apparatus for refreshing a cache, characterized in that, The device includes: The receiving module is configured to receive a refresh instruction for a first cache object in the caching device, the refresh instruction indicating that the cache content in the first cache object be updated; A determination module is used to determine the first cache node of the first cache object in response to the refresh instruction; The determining module is further configured to call a reachability analysis algorithm to calculate the dependency path of the first cache node in the topology, wherein the topology is constructed based on the data dependency relationship between cache objects; The determining module is further configured to determine other cache nodes on the dependency path as second cache nodes, the second cache node caches a second cache object, the second cache object is cached in isolation from the first cache object and has a data dependency relationship; An update module is used to update the cached content of the first cached object and the second cached object on the cache device based on the cached update content of the first cached object, including: when a ring topology exists in the topology, reading all the content corresponding to the first cached object and the second cached object from the external storage device of the cache device, the all content including the content updated based on the cached update content, the all content being obtained from the persistence layer; and replacing and updating the cached content of the first cached object and the second cached object based on the all content. The ring topology includes a first ring topology or a second ring topology. When the ring topology is the first ring topology, there is a circular dependency between the first cache object and some or all of the second cache objects. When the ring topology is the second ring topology, there is a circular dependency between at least two second cache objects.

6. A computer device, characterized in that, The computer device includes a processor and a memory, the memory storing a computer program that is loaded and executed by the processor to implement the method of refreshing the cache as described in any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program, which is loaded and executed by a processor to implement the method of refreshing the cache as described in any one of claims 1 to 4.

Citation Information

Patent Citations

  • Cascade cache refreshing method, system and device

    CN110059023A