An asynchronous cache auditing repair method, device, equipment and medium

By using scheduled tasks and message queues for asynchronous processing, combined with multi-level cache auditing and repair mechanisms, the problem of cache inconsistency in low-code development was solved, achieving consistency of cached content and improving system performance.

CN117216108BActive Publication Date: 2025-12-16CHINA UNITED NETWORK COMM GRP CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202311179120.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2023-09-13
Publication Date
2025-12-16
Estimated Expiration
2043-09-13

AI Technical Summary

Technical Problem

In existing technologies, the inconsistency of cached information caused by low-code development lacks rapid audit and repair methods, which affects the accuracy of system caching.

Method used

The cache audit task is triggered by a scheduled task, and the audit task message is sent asynchronously using a message queue. The audit comparison is performed according to the multi-level cache order, and the inconsistencies are repaired. Different levels of cache locks are used for locking, timestamps are added and cache content is compressed, and log information is recorded.

Benefits of technology

It achieves consistency of multi-level cached content, improves system performance and cache accuracy, reduces waiting time, and ensures the accuracy of audit results.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN117216108B_ABST
    Figure CN117216108B_ABST
Patent Text Reader

Abstract

The application provides an asynchronous cache auditing repair method, device, equipment and medium. The method comprises the following steps: triggering a cache auditing task according to a timing task; sending an auditing task trigger message of a multi-level cache from an auditing task message queue; receiving an auditing task message, which is used for indicating that the multi-level cache is audited; auditing and comparing a first-level cache and a second-level cache; if the auditing and comparison of the first-level cache and the second-level cache pass, starting the auditing and comparison of the second-level cache and a third-level cache; if the auditing and comparison of the first-level cache and the second-level cache do not pass, repairing the second-level cache and the third-level cache according to a repair strategy of a cache configuration. The first-level cache, the second-level cache and the third-level cache are different types of caches. The method improves the consistency of information among different caches.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present application relates to the field of computers, and in particular to an asynchronous cache auditing repair method and device, equipment and medium. BACKGROUND

[0002] At present, low code is mostly used for development in most industry applications. Low code is a visual application development method that delivers applications with less code and at a faster speed. Low code is a set of digital technology tool platforms that realize rapid construction of required business platforms based on graphical drag-and-drop and parameterized configuration and other more efficient ways.

[0003] Because the system uses configuration loading, in order to ensure the rapid loading and rapid online of business, all page configuration rules and other information are configured in the backend. In order to ensure the page loading speed, a large number of cache mechanisms are used, which may cause inconsistencies between caches. SUMMARY

[0004] The present application provides an asynchronous cache auditing repair method, device, equipment and medium to solve the problem of inconsistency between existing caches.

[0005] In one aspect, the present application provides an asynchronous cache auditing repair method, comprising:

[0006] triggering a cache auditing task according to a timing task;

[0007] sending an auditing task trigger message of a multi-level cache from an auditing task message queue;

[0008] receiving an auditing task message, the auditing task message being used to indicate auditing of a multi-level cache;

[0009] auditing and comparing a first-level cache and a second-level cache, if the auditing and comparison of the first-level cache and the second-level cache pass, starting auditing and comparison of the second-level cache and a third-level cache, and if the auditing and comparison of the first-level cache and the second-level cache do not pass, repairing the second-level and third-level caches according to a repair strategy of the cache, the first-level cache, the second-level cache and the third-level cache being different types of caches.

[0010] Further, before auditing the first-level cache and the second-level cache, the method further comprises:

[0011] processing the relational database through a cache model to generate cache content, adding a timestamp to the cache content, and storing the cache content in a cache auditing library.

[0012] Further, before storing in the cache auditing library, the method further comprises:

[0013] compressing the cache content and storing the compressed cache content into the cache audit library.

[0014] Further, after storing into the cache audit library, further comprising:

[0015] sending log information to a log message queue and recording identification information of the current cache content storage task.

[0016] Further, before auditing the multi-level cache, further comprising:

[0017] locking the different levels of cache with different levels of cache locks.

[0018] Further, the different levels of cache locks comprise:

[0019] a first-level lock, which prohibits any cache from performing any update and deletion operation;

[0020] a second-level lock, which only prohibits the first-level cache from performing any update and deletion operation;

[0021] a third-level lock, which only prohibits the non-first-level cache from performing any update operation on the cached content before the current timestamp.

[0022] Further, the method further comprises:

[0023] when auditing and comparing the first-level cache and the second-level cache, adjusting the cache lock to the first-level lock, when auditing and comparing the second-level cache and the third-level cache, adjusting the cache lock to the second-level lock, and after repairing the cache, adjusting to the default third-level lock.

[0024] In another aspect, the application provides an asynchronous cache auditing and repairing device, comprising:

[0025] a triggering module configured to trigger a cache auditing task according to a timing task;

[0026] a sending module configured to send an auditing task triggering message of a first-level cache from an auditing task message queue;

[0027] a receiving module configured to receive an auditing task message, the auditing task message being used to instruct to audit a multi-level cache;

[0028] a comparing module configured to audit and compare data in a cache library according to an auditing sequence of a first-level cache, a second-level cache and a third-level cache; if the auditing and comparison of the first-level cache and the second-level cache passes, starting the auditing and comparison of the second-level cache and the third-level cache; if the auditing and comparison of the first-level cache and the second-level cache fails, repairing the cache according to a repair strategy configured by the cache, the first-level cache, the second-level cache and the third-level cache being different types of caches.

[0029] In a third aspect, the present application provides an electronic device, comprising: a memory and a processor;

[0030] The memory is configured to store computer instructions.

[0031] The processor is configured to execute the computer instructions to implement the method according to any one of claims 1-7.

[0032] In a fourth aspect, the present application provides a computer storage medium, wherein the computer storage medium stores computer instructions, and the computer instructions are executed by a processor to implement the method according to any one of claims 1-7.

[0033] The present application provides an asynchronous cache auditing and repairing method, device, equipment and medium. The cache auditing task is triggered according to a timing task. The auditing task trigger message of the multi-level cache is sent from the auditing task message queue. After receiving the auditing task message, the first-level cache and the second-level cache are audited and compared. If the first-level cache and the second-level cache pass the auditing comparison, the auditing comparison of the second-level cache and the third-level cache is started. If the first-level cache and the second-level cache do not pass the auditing comparison, the second-level cache and the third-level cache are repaired according to the repair strategy of the cache configuration. The consistency of the cache content between different caches is ensured. BRIEF DESCRIPTION OF DRAWINGS

[0034] The accompanying drawings, which are incorporated herein and constitute part of the specification, illustrate embodiments consistent with the present application and, together with the description, serve to explain the principles of the application.

[0035] Figure 1 A flowchart of an asynchronous cache auditing and repairing method provided by the present application is shown.

[0036] Figure 2 A flowchart of another asynchronous cache auditing and repairing method provided by the present application is shown.

[0037] Figure 3 A schematic diagram of an asynchronous cache auditing and repairing device provided by the present application is shown.

[0038] Figure 4 A structural schematic diagram of an electronic device provided by the present application is shown.

[0039] The above-described drawings have shown specific embodiments of the present application, and more detailed descriptions will be given hereinafter. These drawings and written descriptions are not intended to limit the scope of the concept of the present application in any way, but to illustrate the concept of the present application to those skilled in the art by referring to specific embodiments. DETAILED DESCRIPTION

[0040] The exemplary embodiments will be described in detail herein with reference to several drawings. Whenever the shapes, relative arrangements, numerical amounts, and other aspects described herein are expressed as a possibility of multiple alternatives, for example, these alternatives are not to be construed as being mutually exclusive of but can be combined with each other, unless otherwise specified. The following description is presented based on the understanding that aspects of the application are best understood by reading the following description in conjunction with the drawings, although the application is not limited to the embodiments presented herein. Because those skilled in the art will be able to make modifications and variations of the embodiments without the exercise of inventive capacity, the embodiments should not be construed as limiting the scope of the application. Rather, they are intended to convey the scope of the application to those skilled in the art, together with an understanding of the best modes contemplated by the inventors for carrying out the application.

[0041] The existing system mostly uses configuration loading. In order to ensure the rapid loading and rapid online of the business, all page configuration rules and other information are configured in the backend. In order to ensure the page loading speed, a large number of cache mechanisms are used, which may cause inconsistent information between caches, and cannot guarantee the accuracy of the system cache. In addition, there is a lack of fast auditing and repairing means between multi-level caches.

[0042] In view of this, the application provides an asynchronous cache auditing and repairing method, aiming at solving the above technical problems of the prior art.

[0043] The technical solutions of the application and how the technical solutions of the application solve the above technical problems will be described in detail below with specific embodiments. The following specific embodiments can be combined with each other, and the same or similar concepts or processes may not be described again in some embodiments. The embodiments of the application will be described below with reference to the drawings.

[0044] Figure 1 A flowchart of an asynchronous cache auditing and repairing method provided by the embodiment of the application is shown in the figure. The method specifically includes the following steps:

[0045] S101, triggering a cache auditing task according to a timing task.

[0046] The timing task is mainly used for executing certain commands at a certain time, so as to achieve the effect of timing processing data. Taking Quartz as an example, Quartz is an open source, high performance job scheduling framework, which is written in Java and designed for J2SE and J2EE applications. It provides rich scheduling functions and flexible configuration options, which can help developers to realize complex task scheduling and timing task functions. Whether it is a simple timing task, a complex distributed task, or a task that needs to be dynamically managed, such as task starting, pausing, resuming, stopping and trigger time modification, it can be realized by using it.

[0047] The cache can be configured according to a timing task, and the cache to be audited can be configured at different time intervals such as daily and weekly. After reaching the time set in the timing task, the cache auditing task is automatically triggered. The timing task can use, for example, QuartZ, Timer and TimerTask, Spring, Linux Cron, etc.

[0048] S102, send the auditing task trigger message of the multi-level cache from the auditing task message queue.

[0049] The MQ (Message Queue) message queue is an asynchronous communication method for message transmission between different applications and different services. In the asynchronous calling mode, the caller initiates a request and does not need to wait for the called party to return the response immediately, but can continue to perform other operations. When the called party completes the processing, it will notify the caller through a callback function or other means and return the response.

[0050] In this step, the auditing task is sent to the message queue, which can store and distribute messages. The auditing task trigger message of the cache is sent through the message queue. In this way, the caller and the called party do not form a blocking relationship, and the caller can continue to perform other operations without waiting for the response of the called party.

[0051] S103, receive the auditing task message, which is used to indicate the auditing of the multi-level cache.

[0052] The auditing task message is used to indicate the auditing of the multi-level cache. When the auditing task message sent from the message queue is received, the different levels of cache can be audited according to the message.

[0053] S104, audit and compare the first-level cache and the second-level cache. If the auditing and comparison of the first-level cache and the second-level cache pass, start the auditing and comparison of the second-level cache and the third-level cache. If the auditing and comparison of the first-level cache and the second-level cache do not pass, repair the second-level and third-level cache according to the repair strategy of the cache configuration. The first-level cache, the second-level cache and the third-level cache are different types of caches.

[0054] In this scheme, the first-level, second-level and third-level caches are different types of caches. Specifically, the first-level cache is a relational database cache, the second-level cache is a Redis cache, and the third-level cache is a local cache.

[0055] First, the level 1 cache and level 2 cache are audited and compared. If the audit comparison passes, it means that the cache contents of the level 1 and level 2 caches are consistent. At this point, the next level audit task can be started to audit and compare the level 2 and level 3 caches. If the audit comparison fails, it means that the cache contents of the level 1 and level 2 caches are inconsistent. In this case, the level 2 and level 3 caches can be repaired according to the cache configuration repair strategy without needing to perform another audit comparison on the level 2 and level 3 caches.

[0056] The method provided in this embodiment periodically audits and compares the cache according to a scheduled task, and repairs caches that are inconsistent with the content of the first-level cache, so that the cache content of each level of cache can be kept consistent. At the same time, the audit task messages are sent in the form of a message queue, which can be notified asynchronously without waiting for the return of the execution result, thereby reducing the waiting time and improving the system performance.

[0057] As an optional implementation, the following steps may also be included before auditing the multi-level cache:

[0058] Different levels of cache locks are used to lock different levels of cache.

[0059] Specifically, cache locks of different levels can be divided into: Level 1 lock, Level 2 lock, and Level 3 lock.

[0060] Level 1 lock: prohibits any update or deletion operations on the cache.

[0061] The second-level lock only prohibits the first-level cache from performing any update or deletion operations;

[0062] Level 3 locking only prohibits non-level caching from updating any content cached before the current timestamp.

[0063] Optionally, when auditing and comparing the level 1 cache and level 2 cache, the cache lock is adjusted to a level 1 lock; when auditing and comparing the level 2 cache and level 3 cache, the cache lock is adjusted to a level 2 lock; and after repairing the level 2 and level 3 caches, they are adjusted to the default level 3 lock.

[0064] Since the primary lock prohibits any cache from performing any update and deletion operation, when auditing the first and second level caches, the cache lock is adjusted to the primary lock, at this time it can be ensured that all caches do not update or delete during the audit, ensuring the accuracy of the audit result. When auditing the second and third level caches, the cache lock is adjusted to the secondary lock, since the second level cache has been consistent with the first level cache, at this time only the first level cache, i.e. the relational database cache, is prohibited from performing any update or deletion operation. After repairing the second and third level caches, it can be adjusted to the default third level lock. The third level lock is the normal lock, which only prohibits non-primary caches from performing any update operation on the cached content before the current timestamp, i.e. for the second and third level caches, the cached content before the timestamp cannot be updated, but the latest cached content can be updated.

[0065] The method provided by the embodiment adds different levels of cache locks to different caches during auditing, so that the cache does not change due to database update or deletion during auditing, which ensures the accuracy and consistency of the cache during auditing.

[0066] Figure 2 The flowchart of another asynchronous cache auditing and repairing method provided by the application, which specifically includes the following steps:

[0067] S201, triggering a cache auditing task according to a timing task.

[0068] S202 and S203, processing a relational database to generate cache content through a cache processing model according to system configured parameters and interfaces provided by an external system, and storing the cache content with a timestamp to a cache auditing library.

[0069] Since the content stored in the relational database is in the form of a two-dimensional table, and the content stored in the Redis cache library is an object, the relational database needs to be processed, and the processed content is stored in the cache auditing library, which facilitates subsequent auditing and comparison with the content of the Redis cache library. At the same time, a timestamp needs to be added, after adding the timestamp, it can be known when the processing and storage are performed, when the second and third level caches update encounter problems, the cache at a specified time can be returned according to the timestamp, and the cache content at the time is used to update the second and third level caches.

[0070] Optionally, before storing the processed content to the cache auditing library, it can also include: compressing the cache content and storing it to the cache auditing library.

[0071] After the cached content is processed, the memory occupied by the processed object is large, so before storing it in the audit library, it needs to be compressed first. After compression, the storage space occupied is small, and when performing audit comparison, the compared information is also relatively less, which speeds up the audit comparison speed.

[0072] S204, send the log information to the log message queue, and record the identification information of the current cached content storage task.

[0073] After storing the cached content in the audit library, the stored content needs to be recorded. The identification information of the cached content storage task recorded can include task batch number, task number, cached information, etc. Send these information as log information to the log message queue. In this way, it is convenient to troubleshoot problems according to the log record in the future.

[0074] S205, send the audit task trigger message of the multi-level cache from the audit task message queue.

[0075] After receiving the audit task message, the first-level cache and the second-level cache are audited and compared. If the first-level cache and the second-level cache pass the audit comparison, the audit comparison of the second-level cache and the third-level cache is started; if the first-level cache and the second-level cache do not pass the audit comparison, the second-level cache and the third-level cache are repaired according to the repair strategy of the cache configuration.

[0076] S201, S205 is similar to the steps in Embodiment One, which will not be repeated here.

[0077] As shown in Figure 2 When receiving the local cache emptying instruction sent by S206, S207, and S208, the instruction distribution is realized through the message queue, the local cache is emptied, and the log is recorded.

[0078] Since the local cache is the last level of cache, when the content of the current two-level cache is updated, the local cache is inconsistent with other cache content. Therefore, the local cache needs to be emptied every time it is repaired, and after being emptied, the latest cache content is obtained for updating, so that the local cache is consistent with other caches.

[0079] The method provided in this embodiment further processes the relational database, adds a timestamp, and sends log information to the log message queue to record the identification information of the cached content storage task. This makes it easy to audit and compare between caches, and the cached content stored at different times can be found through the added timestamp. At the same time, according to the information recorded in the log, the change track of the cache can be tracked, which facilitates subsequent processing of problems and faults.

[0080] Figure 3 An asynchronous cache audit repair device provided by the embodiments of the present application comprises:

[0081] triggering module, configured to trigger the cache auditing task according to the timing task;

[0082] sending module, configured to send the auditing task triggering message of the multi-level cache from the auditing task message queue;

[0083] receiving module, configured to receive the auditing task message, the auditing task message being used to instruct to audit the multi-level cache;

[0084] comparing module, configured to compare and audit the data in the cache library according to the auditing sequence of the first-level cache, the second-level cache and the third-level cache; if the comparison and auditing of the first-level cache and the second-level cache passes, the comparison and auditing of the second-level cache and the third-level cache is started; if the comparison and auditing of the first-level cache and the second-level cache does not pass, the cache is repaired according to the repair strategy of the cache configuration, and the first-level cache, the second-level cache and the third-level cache are different types of caches.

[0085] Figure 4 An electronic device is also provided in the embodiments of the present application, comprising a memory and a processor;

[0086] The memory is used to store computer instructions;

[0087] The processor is used to execute the computer instructions to realize the method shown in any one of claims 1-7.

[0088] The embodiments of the present application also provide a computer storage medium, which stores computer instructions, and the computer instructions are executed by the processor to realize the method shown in any one of claims 1-7.

[0089] Other embodiments of the present application will be apparent to those skilled in the art from consideration of the specification and practice of the application disclosed herein. The specification and examples given are exemplary only, with the true scope and spirit of the application being indicated by the following claims. The application is to be limited only by the claims sufficiently supported by this description.

[0090] It should be understood that the application is not limited to the precise construction that has been described above and shown in the accompanying drawings, and that various modifications and changes can be made by those skilled in the art without departing from the scope of the application. The scope of the application is to be limited only by the appended claims.

Claims

1. An asynchronous cache audit repair method, characterized by, The method comprises the following steps: triggering a cache auditing task according to a timing task; sending an auditing task trigger message of a multi-level cache from an auditing task message queue; receiving an auditing task message, which is used to indicate auditing of the multi-level cache; auditing and comparing a first-level cache and a second-level cache, if the first-level cache and the second-level cache pass the auditing comparison, starting auditing and comparing the second-level cache and a third-level cache, if the first-level cache and the second-level cache fail the auditing comparison, repairing the second-level cache and the third-level cache according to a repair strategy configured by the cache, the first-level cache, the second-level cache and the third-level cache being different types of caches; before auditing the multi-level cache, the method further comprises the following steps: locking the caches of different levels by using different levels of cache locks, the different levels of cache locks comprising a first-level lock, which prohibits any cache from performing any update and deletion operation, a second-level lock, which only prohibits the first-level cache from performing any update and deletion operation, and a third-level lock, which only prohibits non-first-level caches from performing any update operation on the cached content before a current timestamp; when auditing and comparing the first-level cache and the second-level cache, adjusting the cache lock to the first-level lock, when auditing and comparing the second-level cache and the third-level cache, adjusting the cache lock to the second-level lock, and after repairing the second-level cache and the third-level cache, adjusting to the default third-level lock.

2. The method of claim 1, wherein, before auditing the first-level cache and the second-level cache, the method further comprises the following steps: processing a relational database by using a cache model to generate cache content, adding a timestamp to the cache content, and storing the cache content into a cache auditing library.

3. The method of claim 2, wherein, before storing the cache content into the cache auditing library, the method further comprises the following step: compressing the cache content and storing the compressed cache content into the cache auditing library.

4. The method according to claim 2 or 3, characterized in that, after storing the cache content into the cache auditing library, the method further comprises the following step: sending log information to a log message queue and recording identification information of a current cache content storage task.

5. An apparatus for asynchronous cache coherency repair, comprising: The method comprises the following steps: a triggering module, which is configured to trigger a cache auditing task according to a timing task; a sending module, which is configured to send an auditing task trigger message of a multi-level cache from an auditing task message queue; a receiving module, which is configured to receive an auditing task message, which is used to indicate auditing of the multi-level cache; a comparing module, which is configured to audit and compare data in a cache library according to an auditing sequence of a first-level cache, a second-level cache and a third-level cache, if the first-level cache and the second-level cache pass the auditing comparison, starting auditing and comparing the second-level cache and the third-level cache, if the first-level cache and the second-level cache fail the auditing comparison, repairing the cache according to a repair strategy configured by the cache, the first-level cache, the second-level cache and the third-level cache being different types of caches. The comparison module is further configured to lock the caches of different levels by using different levels of cache locks before auditing the multi-level caches; the different levels of cache locks include: a first level lock, which prohibits any cache from performing any update and deletion operation; a second level lock, which only prohibits the first level cache from performing any update and deletion operation; and a third level lock, which only prohibits the non-first level cache from performing any update operation on the cached content before the current timestamp; when auditing the first level cache and the second level cache, the cache lock is adjusted to the first level lock; when auditing the second level cache and the third level cache, the cache lock is adjusted to the second level lock; and after repairing the second level cache and the third level cache, the cache lock is adjusted to the default third level lock.

6. An electronic device, comprising: Comprise: a memory and a processor; the memory is configured to store computer execution instructions; the processor is configured to execute the computer execution instructions to implement the method of any one of claims 1-4.

7. A computer storage medium, characterized in that The computer storage medium stores computer execution instructions, and the computer execution instructions are executed by the processor to implement the method of any one of claims 1-4.

Citation Information

Patent Citations

  • Data caching system and method and server equipment

    CN115687370A