A cache processing method, electronic device and computer storage medium

CN113778913BActive Publication Date: 2025-02-21BEIJING WODONG TIANJUN INFORMATION TECH CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202111076159.8
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2021-09-14
Publication Date
2025-02-21
Estimated Expiration
2041-09-14

AI Technical Summary

Technical Problem

The existing cache processing methods are not flexible and scalable, and cannot simply expand the cache strategy according to business needs, and custom caches are difficult to support dynamic elimination scenarios.

Method used

By obtaining the CRUD operations to be operated cached and obtaining the entry and exit rules of cached data from the preset cache factory, the operation position of the CRUD operations is determined, and the cache to be operated is processed according to the CRUD operations and operation positions.

Benefits of technology

It improves the flexibility and scalability of cache processing, avoids the situation where a single entry and exit rule is not applicable, facilitates the generation of entry and exit rules based on actual needs, and enhances the cache processing capability.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN113778913B_ABST
    Figure CN113778913B_ABST
Patent Text Reader

Abstract

The embodiment of the present application discloses a cache processing method, including: obtaining a CRUD operation for a cache to be operated, obtaining an entry and exit rule generated for cache data of the cache to be operated from a preset cache factory, determining an operation position of the CRUD operation from the cache to be operated according to the entry and exit rule, and processing the cache to be operated according to the CRUD operation and the operation position. The embodiment of the present application also provides an electronic device and a computer storage medium.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to cache processing technology, and in particular to a cache processing method, electronic device and computer storage medium. Background Art

[0002] At present, the use of complex heavyweight distributed caches has increased the complexity of the system and made the application scenarios of some simple caches complicated; the existing local caches have poor scalability and cannot simply expand the cache strategy according to business needs; when using local custom caches, most developers use a simple key-value pair MAP structure to implement it, which cannot support some scenarios that require dynamic elimination; it can be seen that the existing cache processing methods have fixed and single technical problems. Summary of the invention

[0003] The embodiments of the present application provide a cache processing method, an electronic device, and a computer storage medium, which can improve the flexibility of cache processing.

[0004] The technical solution of this application is implemented as follows:

[0005] The present application embodiment provides a cache processing method, including:

[0006] Get the CRUD operations for the cache to be operated;

[0007] Obtaining, from a preset cache factory, entry and exit rules generated for the cache data of the cache to be operated;

[0008] According to the entry and exit rules, determining the operation position of the CRUD operation from the cache to be operated;

[0009] The cache to be operated is processed according to the CRUD operation and the operation position.

[0010] An embodiment of the present application provides an electronic device, including:

[0011] The first acquisition module is used to acquire the CRUD operation for the cache to be operated;

[0012] A second acquisition module is used to acquire, from a preset cache factory, an entry and exit rule generated for the cache data of the cache to be operated;

[0013] A determination module, used to determine the operation position of the CRUD operation from the cache to be operated according to the entry and exit rules;

[0014] A processing module is used to process the cache to be operated according to the CRUD operation and the operation position.

[0015] An embodiment of the present application also provides an electronic device, comprising: a processor and a storage medium storing instructions executable by the processor, wherein the storage medium relies on the processor to perform operations via a communication bus, and when the instructions are executed by the processor, the cache processing method described in one or more of the above embodiments is executed.

[0016] An embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the cache processing method described in one or more of the above embodiments.

[0017] The embodiment of the present application provides a cache processing method, an electronic device and a computer storage medium, including: obtaining a CRUD operation for a cache to be operated, obtaining an entry and exit rule generated for cache data of the cache to be operated from a preset cache factory, determining an operation position of the CRUD operation from the cache to be operated according to the entry and exit rule, and processing the cache to be operated according to the CRUD operation and the operation position; that is, in the embodiment of the present application, the cache factory generates entry and exit rules for cache data for the cache to be operated. When a CRUD operation is performed on the cache to be operated, the entry and exit rules for the cache data in the cache to be operated can be obtained by obtaining the entry and exit rules generated for the cache data of the cache to be operated from the preset cache factory, so that the operation position of the CRUD operation can be obtained from the cache to be operated. In this way, since the cache factory can generate entry and exit rules for cache data, the cache factory can generate entry and exit rules for the cache data of the cache to be operated according to actual needs, avoiding the situation where a single entry and exit rule is not applicable, and the entry and exit rules of the cache data of the cache to be operated are more conveniently generated by the cache factory, which is conducive to performing CRUD operations on the cache to be operated, thereby improving the flexibility of cache processing and increasing the scalability of cache processing. BRIEF DESCRIPTION OF THE DRAWINGS

[0018] Figure 1 A flowchart of an optional cache processing method provided in an embodiment of the present application;

[0019] Figure 2 A schematic diagram of the structure of an example of an optional software toolkit provided in an embodiment of the present application;

[0020] Figure 3 A flowchart of an example of an optional cache processing method provided in an embodiment of the present application;

[0021] Figure 4 A screenshot of the code corresponding to an optional deletion operation provided in an embodiment of the present application;

[0022] Figure 5A schematic diagram of the structure of an electronic device provided in an embodiment of the present application Figure 1 ;

[0023] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application Figure 2 . DETAILED DESCRIPTION

[0024] The technical solutions in the embodiments of the present application will be clearly and completely described below in conjunction with the drawings in the embodiments of the present application.

[0025] Embodiment 1

[0026] The present application embodiment provides a cache processing method, Figure 1 A flowchart of an optional cache processing method provided in an embodiment of the present application is provided, referring to Figure 1 As shown, the cache processing method may include:

[0027] S101: Obtain CRUD operations for the cache to be operated;

[0028] At present, caches are divided into three categories: distributed caches, such as redis, local caches, such as caffine, and custom caches. For distributed caches, the complex configuration of distributed caches and the numerous application programming interfaces (APIs) make simple cache usage scenarios extremely complicated; for local caches, local caches have poor scalability and it is difficult to implement custom cache strategies; and when using local custom caches, most developers use simple key-value pair structures to implement them, which cannot support some scenarios that require dynamic elimination; it can be seen that the existing custom caches have poor flexibility and scalability.

[0029] In order to improve the flexibility and scalability of cache processing, an embodiment of the present application provides a cache processing method. First, a CRUD operation for the cache to be operated is obtained; wherein the CRUD operation may include an insert operation (C), a query operation (R), a modification operation (U) and a delete operation (D). Here, the embodiment of the present application does not make any specific limitations on this.

[0030] In order to obtain the CRUD operation to be cached, in an optional embodiment, S101 may include:

[0031] Obtain the CRUD operations for the cache to be operated through the CRUD operation interface.

[0032] Specifically, in the embodiment of the present application, a corresponding interface is provided for each operation of the CRUD operation of the cache to be operated. For example, an insert interface is set for the insert operation, a query interface is set for the query operation, a modification interface is set for the modification operation, and a deletion interface is set for the deletion operation. Then, the insert operation for the cache to be operated can be obtained through the insert interface, the query operation for the cache to be operated can be obtained through the query interface, the modification operation for the cache to be operated can be obtained through the modification interface, and the deletion operation for the cache to be operated can be obtained through the deletion interface.

[0033] It should be noted that, in addition to the above-mentioned interfaces, other interfaces are also provided in the embodiments of the present application, and corresponding functions are implemented through the interfaces provided in the embodiments of the present application.

[0034] S102: Obtaining, from a preset cache factory, entry and exit rules generated for cache data to be cached;

[0035] Specifically, for the cache to be operated, the cache factory generates entry and exit rules for the cache data of the cache to be operated in advance, so that the cache to be operated processes the cache data according to the generated entry and exit rules.

[0036] Then, when a CRUD operation of the cache to be operated is received, in order to implement the CRUD operation of the cache to be operated, it is necessary to first obtain the entry and exit rules of the cache data of the cache to be operated from the preset cache factory, so as to implement the CRUD operation of the cache to be operated according to the entry and exit rules, wherein the above-mentioned entry and exit rules may include: first-in-first-out, first-in-last-out, random entry and exit, entry and exit by weight, etc., and the embodiment of the present application does not make specific limitations on this.

[0037] Here, through the cache factory, based on the factory pattern, entry and exit rules are generated for the cached data of the cache, avoiding the limitations of fixed and single entry and exit rules on the cache solution. Through the cache factory, entry and exit rules can be easily generated for the cache to improve the flexibility and scalability of the cache.

[0038] S103: Determine the operation position of the CRUD operation from the cache to be operated according to the entry and exit rules;

[0039] After obtaining the entry and exit rules of the cache data of the cache to be operated, for each CRUD operation, the operation position can be determined according to the entry and exit rules. Specifically, when the entry and exit rule is first-in-first-out, taking the insert operation as an example, in order to insert the data carried by the insert operation into the cache to be operated, the insertion position of the insert data carried in the insert operation, that is, the operation position, can be determined according to the entry and exit rules. If the cache to be operated is full, the cache data that enters the cache to be operated first can be deleted.

[0040] In this way, after the operation position is determined, the CRUD operation can be performed on the operation position. That is to say, the operation position of the CRUD operation can be easily known on the basis of knowing the entry and exit rules, which is beneficial to cache processing.

[0041] S104: Process the cache to be operated according to the CRUD operation and the operation position.

[0042] Specifically, for each operation in the CRUD operation, the method of processing the cache to be operated is different. In an optional embodiment, S104 may include:

[0043] When the CRUD operation is an insert operation for inserting data, the insert data is added to the operation position;

[0044] When the CRUD operation is a delete operation, the cached data at the operation location is deleted.

[0045] That is to say, for the insert operation, the purpose of the insert operation is to insert the insert data into the cache to be operated. In order to insert the insert data into the cache to be operated, it is first necessary to determine the insertion position of the insert data, that is, the above-mentioned operation position. Here, the operation position can be determined according to the entry and exit rules. For example, taking the first-in-first-out as an example, the insert data currently to be inserted needs to be placed at the position after the previous insert data. In this way, the operation position of the insert operation can be determined, and the insert data can be inserted into the operation position in the cache to be operated, so as to implement the first-in-first-out entry and exit rules.

[0046] For the deletion operation, the purpose of the deletion operation is to delete the cached data in the cache to be operated. In order to delete the cached data in the cache to be operated, it is first necessary to determine the operation position of the cached data to be deleted, that is, the above-mentioned operation position. Here, the operation position can be determined according to the entry and exit rules. For example, taking the first-in-first-out as an example, the cached data that currently needs to be deleted should be the earliest cached data to enter. In this way, the operation position of the deletion operation can be determined, and the earliest cached data to enter can be deleted from the operation position to implement the first-in-first-out entry and exit rule.

[0047] The above-mentioned cache processing method can realize the insertion and deletion of cache data in the cache, and the cache factory is used to generate different entry and exit rules, which is conducive to realizing the processing methods of different caches.

[0048] In order to implement different processing for different caches, in an optional embodiment, the above method may further include:

[0049] Determine the type of cache to be operated;

[0050] Determine the entry and exit rules corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the entry and exit rules;

[0051] The entry and exit rules corresponding to the type of the cache to be operated are determined as the entry and exit rules for the cache data of the cache to be operated.

[0052] Specifically, the type of cache to be operated is first determined, and the correspondence between the cache type and the access rules is pre-set, that is, corresponding access rules are set for different cache types, which improves the flexibility of the cache compared with the existing cache setting of fixed single access rules.

[0053] Here, corresponding entry and exit rules are set for different types of caches. Then, when performing CRUD operations, the insertion and deletion operations are handled differently according to different types of caches. Taking first-in-first-out as an example, for insertion operations, the inserted data is inserted to the position after the last inserted data. For deletion operations, the cached data that first enters the cache is deleted. Taking the entry and exit rule of entering and exiting according to the weight value of the data as an example, for inserted data, the weight value of the inserted data is put into the weight value of the cached data for sorting, and the position after the cached data to which the weight value that ranks ahead of the weight value of the inserted data in the sorting result is determined as the insertion position of the inserted data. The deletion operation is similar and will not be repeated here.

[0054] In addition, in order to implement different processing for different caches, in an optional embodiment, the above method may further include:

[0055] Determine the type of cache to be operated;

[0056] Determine the elimination strategy corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the elimination strategy;

[0057] The elimination strategy corresponding to the type of the cache to be operated is determined as the elimination strategy for cache data of the cache to be operated.

[0058] That is to say, a correspondence between the cache type and the elimination strategy is preset, that is, corresponding elimination strategies are set for different cache types. Here, the cached data in the cache can be deleted according to the elimination strategy, wherein the elimination strategy can be a timed elimination strategy, a random elimination strategy, or an elimination strategy for migrating cached data. Here, the embodiment of the present application does not make specific limitations on this; compared with the existing cache setting of a fixed and single elimination strategy, the flexibility of the cache is improved.

[0059] Here, corresponding elimination strategies are set for different types of caches. Then, when performing CRUD operations, the elimination strategies are different according to different types of caches. Taking the elimination strategy of clearing the cached data in the cache every 30 minutes as an example, the cached data in the cache is cleared every 30 minutes. Taking the elimination strategy of deleting the cached data in the weighted cache according to the weight value every 30 minutes as an example, the cached data with a weight value lower than the preset threshold is deleted every 30 minutes.

[0060] Furthermore, in order to implement different processing for different caches, in an optional embodiment, the above method may further include:

[0061] Determine the type of cache to be operated;

[0062] Determine the exception handling strategy corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the exception handling strategy;

[0063] The exception handling strategy corresponding to the type of the cache to be operated is determined as the exception handling strategy for cache data of the cache to be operated.

[0064] That is to say, a correspondence between the cache type and the exception handling strategy is preset, that is, corresponding exception handling strategies are set for different cache types. Here, the cache data of the cache can be processed according to the exception handling strategy, wherein the exception handling strategy can be a prompt for a specific operation, wherein the specific operation can be an insert operation for specific data, or a query operation for specific data, or a modification operation for specific data. Here, the embodiment of the present application does not make specific limitations on this; compared with the existing cache setting of a fixed and single exception handling strategy, the flexibility of the cache is improved.

[0065] Here, corresponding exception handling strategies are set for different types of caches. Then, when performing CRUD operations, the exception handling strategies are different according to different types of caches. The exception handling strategy is for insert operations of specific data. When the insertion operation containing specific data in the operation information is captured using the aspect technology, information is generated to prompt that an exception has occurred.

[0066] In order to determine the type of the cache to be operated, in an optional embodiment, determining the type of the cache to be operated includes:

[0067] When the cache to be operated is used to store data in a memory of a central processing unit (CPU), determining that the type of the cache to be operated is a CPU cache;

[0068] When the cache to be operated is used to store data in the browser, determining that the type of the cache to be operated is a browser cache;

[0069] When the cache to be operated is used to store data in a content delivery network (CDN), determining that the type of the cache to be operated is a CDN cache;

[0070] When the cache to be operated is used to store data in a database, it is determined that the type of the cache to be operated is a database cache.

[0071] Specifically, the cache can be divided into CPU cache, browser cache, CDN cache, database cache, etc. Here, the embodiment of the present application does not make specific limitations on this.

[0072] Here, the cache to be operated can be classified according to its purpose. When the cache to be operated is used to store data in the CPU memory, the type of the cache to be operated is determined to be CPU cache. The capacity of the CPU cache is much smaller than that of the memory, but the exchange speed is much faster than that of the memory. When the cache to be operated is used to store data in the browser, the type of the cache to be operated is determined to be browser cache. The browser cache can cache some static resources, such as pictures, js, css, etc. These are content that does not change often, so there is no need to request them every time. Similarly, when the cache to be operated is used to store data in the CDN, the type of the cache to be operated is determined to be CDN cache, in which the client will first check If the browser cache expires, it will send a request to the CDN. If the CDN checks that the cached data has not expired, it will directly return a response. It only takes two steps to complete the task. However, if the CDN cache expires, it is necessary to initiate a request to the application server to obtain a new data response. This new data will be cached in the CDN according to a certain cache strategy. When the cache to be operated is used to store data in the database, the type of the cache to be operated is determined to be a CDN cache. The cache is added between the application server and the database because the data stored in the cache has the characteristics of persistence, so reading and writing will involve disk input and output (IO, InputOutput) operations, and the reading and writing speed of the memory is much faster than that of the disk.

[0073] For specific operations and specific exceptions, in order to capture the specific operations and specific exceptions, in an optional embodiment, the above method may further include:

[0074] Use aspect technology to capture the operation information of the cache to be operated;

[0075] When the operation information includes operation information of a specific operation, generating first prompt information; wherein the first prompt information is used to prompt that a specific operation occurs in the cache to be operated;

[0076] When the operation information includes information for indicating that a specific exception has occurred, second prompt information is generated; wherein the second prompt information is used to prompt that a specific exception has occurred in the cache to be operated.

[0077] Specifically, for all operations occurring in the cache, aspect technology can be used to monitor and capture the operation information of the cache to be operated. The operation information may include operation information of insert operations, operation information of query operations, operation information of modify operations, operation information of delete operations, etc. Here, the embodiments of the present application do not make specific limitations on this.

[0078] In addition, abnormal operations are likely to occur in the process of operating the cache. Therefore, here, after capturing the operation information of the cache to be operated, it is necessary to determine whether the operation information contains operation information of a specific operation, or whether it contains information indicating that a specific exception has occurred. When the operation information contains operation information of a specific operation, information is generated to prompt that the cache to be operated has a specific operation. The information is used to prompt that a specific operation has occurred in the cache to be operated. For example, if the specific operation is an insert operation to insert specific data, when the operation information contains operation information of an insert operation to insert specific data, a first prompt information is generated.

[0079] When the operation information contains information indicating that a specific exception has occurred, information is generated to prompt that a specific exception has occurred in the cache to be operated. For example, the specific exception is to clear the data in the cache. When the operation information contains information indicating that the data in the cache has been cleared, a second prompt information is generated. In addition, when a specific exception occurs, the exception handling strategy corresponding to the specific exception can be used to handle the specific exception according to the type of the cache to be operated.

[0080] The following example is used to illustrate the cache processing method described in one or more of the above embodiments.

[0081] Figure 2 A schematic diagram of the structure of an example of an optional software toolkit provided in an embodiment of the present application, such as Figure 2 As shown, the software toolkit involved in this example can be embedded in any software system, and the configuration work is completed through annotations in the system. The specific technical architecture is as follows Figure 2 Shown include: cache factory, cache interface, cache implementation, cache listener, cache exception handling and unified log processing.

[0082] Among them, the cache factory is: based on the factory pattern, all types of caches are generated from this factory, and users only need to inject this factory to achieve instant trial of all caches.

[0083] Cache interface: By abstracting the common behaviors of the cache into interfaces, such as inserting cache, querying cache, clearing cache, etc., the specific cache type can implement its own differentiated features, such as different elimination strategies and different monitoring mechanisms.

[0084] Cache listener: Using the "aspect" mechanism of the software system, you can monitor specific behaviors in the cache and make some personalized processing. For example, when inserting a specific cache, issuing an alarm, sending an email, etc. can be freely implemented by the user in the cache listener, and the message queue is sent to the monitoring processor.

[0085] Unified exception handling and unified log processing: Configure a unified aspect for exception handling, capture exceptions that occur in the cache, and perform personalized processing for specific exceptions, such as prompting the user if the exception clearing fails; configure a unified aspect for log processing, capture specific logs that occur in the cache, and perform personalized processing for specific logs.

[0086] Figure 3 A flowchart of an example of an optional cache processing method provided in an embodiment of the present application is shown as follows: Figure 3 As shown, the cache processing method may include:

[0087] S301: Get cache factory;

[0088] S302: Obtain the cache type from the cache factory;

[0089] The cache type is equivalent to the entry and exit rules of the cache data.

[0090] S303: Perform CRUD operations on the cache;

[0091] S304: Return the operation result;

[0092] Among them, the above S301-S304 is a normal cache processing flow. If there is no abnormality in the cache, the operation result is returned normally within this flow.

[0093] S305: Capturing specific operations in the cache;

[0094] S306: Processing a specific operation;

[0095] S307: Capture specific exceptions in the cache;

[0096] S308: Process the specific exception.

[0097] Specifically, the cache listener uses aspect technology to capture specific operations and uses aspect technology to capture specific exceptions. The "cache listener" and "unified exception handling" can be dynamically expanded within the software system without affecting normal business processes. They are decoupled from other modules of the software system and are relatively lightweight.

[0098] If any process node generates an exception during the operation, it will be captured by the "unified exception handling" in the form of a section, and no unhandled exception will be missed. The technical processing is carried out according to the following process:

[0099] When performing cache operations, use aspect technology to capture all exceptions during CRUD operations, and call exception handling methods when exceptions are captured. Each exception is handled specifically to ensure that users can clearly understand the cause and solution of the exception.

[0100] The method in this example can be used in the following business scenarios:

[0101] The first one is the basic usage scenario

[0102] i. Backend developers introduce cache toolkits into their own software systems.

[0103] ii. Get a specific type of cache by injecting a cache factory.

[0104] iii. Use the generated specific cache to perform cache operations.

[0105] The second type is advanced usage scenarios

[0106] i. Back-end developers introduce caching tools into their own software systems.

[0107] ii. Custom cache implements the cache interface in the cache tool, customizes the elimination strategy, monitoring method, etc.

[0108] iii. Get the cache of custom type by injecting the cache factory.

[0109] iv. Use the generated custom cache to perform cache operations.

[0110] The specific way to use the tool is as follows: inject the cache factory into the class that needs to use the cache; implement the cache monitoring strategy according to the specific business scenario; and use the generated cache to perform a series of cache operations.

[0111] Figure 4 A code screenshot corresponding to an optional deletion operation provided in an embodiment of the present application, such as Figure 4As shown, since the cache capacity is only 3, when the fourth element is added, according to the First Input First Output (FIFO) rule, the object in the first house will be removed.

[0112] Through the above examples, for basic cache application scenarios, users can directly produce built-in caches from the cache factory, which can be used immediately and have certain scalability. Users can customize monitoring strategies, exception handling mechanisms, etc., and the usage threshold is low; for complex cache application scenarios, users can customize cache implementation classes, implement cache interfaces, and complete the implementation and use of specific caches within the system, with low expansion costs.

[0113] The embodiment of the present application provides a cache processing method, including: obtaining a CRUD operation for a cache to be operated, obtaining an entry and exit rule generated for cache data of the cache to be operated from a preset cache factory, determining an operation position of the CRUD operation from the cache to be operated according to the entry and exit rule, and processing the cache to be operated according to the CRUD operation and the operation position; that is, in the embodiment of the present application, the cache factory generates entry and exit rules for cache data for the cache to be operated. When a CRUD operation is performed on the cache to be operated, the entry and exit rules for the cache data in the cache to be operated can be obtained by obtaining the entry and exit rules generated for the cache data of the cache to be operated from the preset cache factory, so that the operation position of the CRUD operation can be obtained from the cache to be operated. In this way, since the cache factory can generate entry and exit rules for cache data, the cache factory can generate entry and exit rules for the cache data of the cache to be operated according to actual needs, avoiding the situation where a single entry and exit rule is not applicable, and the entry and exit rules for the cache data of the cache to be operated are more conveniently generated by the cache factory, which is conducive to performing CRUD operations on the cache to be operated, thereby improving the flexibility of cache processing and increasing the scalability of cache processing.

[0114] Embodiment 2

[0115] Figure 5 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application Figure 1 ,like Figure 5 As shown, it includes: a first acquisition module 51, a second acquisition module 52, a determination module 53 and a processing module 54; wherein,

[0116] A first acquisition module 51 is used to acquire CRUD operations for the cache to be operated;

[0117] A second acquisition module 52 is used to acquire, from a preset cache factory, an entry and exit rule generated for cache data to be cached;

[0118] A determination module 53, used to determine the operation position of the CRUD operation from the cache to be operated according to the entry and exit rules;

[0119] The processing module 54 is used to process the cache to be operated according to the CRUD operation and the operation position.

[0120] Optionally, the first acquisition module 51 is specifically configured to:

[0121] Obtain the CRUD operations for the cache to be operated through the CRUD operation interface.

[0122] Optionally, the electronic device is also used for:

[0123] Determine the type of cache to be operated;

[0124] Determine the entry and exit rules corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the entry and exit rules;

[0125] The entry and exit rules corresponding to the type of the cache to be operated are determined as the entry and exit rules for the cache data of the cache to be operated.

[0126] Optionally, the electronic device is also used for:

[0127] Determine the type of cache to be operated;

[0128] Determine the elimination strategy corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the elimination strategy;

[0129] The entry and exit rules corresponding to the type of the cache to be operated are determined as the elimination strategy of the cache data of the cache to be operated.

[0130] Optionally, the electronic device is also used for:

[0131] Determine the type of cache to be operated;

[0132] Determine the exception handling strategy corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the exception handling strategy;

[0133] The exception handling strategy corresponding to the type of the cache to be operated is determined as the exception handling strategy for cache data of the cache to be operated.

[0134] Optionally, the electronic device determines the type of cache to be operated, including:

[0135] When the cache to be operated is used to store data in the memory of the CPU, determining that the type of the cache to be operated is a CPU cache;

[0136] When the cache to be operated is used to store data in the browser, determining that the type of the cache to be operated is a browser cache;

[0137] When the cache to be operated is used to store data in the CDN, determining that the type of the cache to be operated is a CDN cache;

[0138] When the cache to be operated is used to store data in a database, it is determined that the type of the cache to be operated is a database cache.

[0139] Optionally, the processing module 54 is specifically configured to:

[0140] When the CRUD operation is an insert operation for inserting data, the insert data is added to the operation position;

[0141] When the CRUD operation is a delete operation, the cached data at the operation location is deleted.

[0142] In practical applications, the first acquisition module 51, the second acquisition module 52, the determination module 53 and the processing module 54 can be implemented by a processor located on the electronic device, specifically a central processing unit (CPU), a microprocessor (MPU), a digital signal processor (DSP) or a field programmable gate array (FPGA).

[0143] Figure 6 A schematic diagram of the structure of an electronic device provided in an embodiment of the present application Figure 2 ,like Figure 6 As shown, an embodiment of the present application provides an electronic device 600, including:

[0144] A processor 61 and a storage medium 62 storing executable instructions of the processor 61, wherein the storage medium 62 relies on the processor 61 to perform operations through a communication bus 63, and when the instructions are executed by the processor 61, the cache processing method described in the above embodiment 1 is executed.

[0145] It should be noted that in actual application, the various components in the terminal are coupled together through the communication bus 63. It is understandable that the communication bus 63 is used to realize the connection and communication between these components. In addition to the data bus, the communication bus 63 also includes a power bus, a control bus and a status signal bus. However, for the sake of clarity, Figure 6 Various buses are labeled as communication buses 63.

[0146] An embodiment of the present application provides a computer storage medium storing executable instructions. When the executable instructions are executed by one or more processors, the processors execute the cache processing method described in the first embodiment.

[0147] Among them, the computer-readable storage medium can be a ferromagnetic random access memory (FRAM), a read-only memory (ROM), a programmable read-only memory (PROM), an erasable programmable read-only memory (EPROM), an electrically erasable programmable read-only memory (EEPROM), a flash memory, a magnetic surface memory, an optical disk, or a compact disc read-only memory (CD-ROM) and other memories.

[0148] Those skilled in the art will appreciate that the embodiments of the present application may be provided as methods, systems, or computer program products. Therefore, the present application may adopt the form of hardware embodiments, software embodiments, or embodiments in combination with software and hardware. Moreover, the present application may adopt the form of a computer program product implemented on one or more computer-usable storage media (including but not limited to disk storage and optical storage, etc.) that contain computer-usable program code.

[0149] The present application is described with reference to the flowcharts and / or block diagrams of the methods, devices (systems), and computer program products according to the embodiments of the present application. It should be understood that each process and / or box in the flowchart and / or block diagram, as well as the combination of the processes and / or boxes in the flowchart and / or block diagram, can be implemented by computer program instructions. These computer program instructions can be provided to a processor of a general-purpose computer, a special-purpose computer, an embedded processor, or other programmable data processing device to generate a machine, so that the instructions executed by the processor of the computer or other programmable data processing device generate instructions for implementing the processes in the flowchart and / or block diagram. Figure 1 A process or multiple processes and / or boxes Figure 1 A device that provides the functions specified in a block or multiple blocks.

[0150] These computer program instructions may also be stored in a computer-readable memory capable of directing a computer or other programmable data processing device to operate in a specific manner, so that the instructions stored in the computer-readable memory produce an article of manufacture comprising an instruction device, which implements the process Figure 1 A process or multiple processes and / or boxes Figure 1 A function specified in one or more boxes.

[0151] These computer program instructions can also be loaded onto a computer or other programmable data processing device so that a series of operating steps are executed on the computer or other programmable device to produce a computer-implemented process, thereby providing instructions for implementing the process. Figure 1 A process or multiple processes and / or boxes Figure 1 The steps for the functions specified in one or more boxes.

[0152] The above description is only a preferred embodiment of the present application and is not intended to limit the protection scope of the present application.

Claims

1. A cache processing method, characterized in that: include: Get the CRUD operations for the cache to be operated; Obtaining, from a preset cache factory, entry and exit rules generated for the cache data of the cache to be operated; According to the entry and exit rules, determining the operation position of the CRUD operation from the cache to be operated; Processing the cache to be operated according to the CRUD operation and the operation position; Capturing the operation information of the cache to be operated by using the aspect technology; When the operation information includes operation information of a specific operation, generating first prompt information; wherein the first prompt information is used to prompt that the cache to be operated has a specific operation; When the operation information includes information indicating that a specific exception has occurred, second prompt information is generated; wherein the second prompt information is used to prompt that a specific exception has occurred in the cache to be operated.

2. The method according to claim 1, characterized in that The obtaining of the CRUD operation for the cache to be operated includes: The CRUD operation for the cache to be operated is obtained through the CRUD operation interface.

3. The method according to claim 1, characterized in that The method further comprises: Determine the type of the cache to be operated; Determine the entry and exit rules corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the entry and exit rules; The entry and exit rules corresponding to the type of the cache to be operated are determined as the entry and exit rules of the cache data of the cache to be operated.

4. The method according to claim 1, characterized in that: The method further comprises: Determine the type of the cache to be operated; Determine the elimination strategy corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the elimination strategy; The entry and exit rules corresponding to the type of the cache to be operated are determined as the elimination strategy for the cache data of the cache to be operated.

5. The method according to claim 1, characterized in that: The method further comprises: Determine the type of the cache to be operated; Determine the exception handling strategy corresponding to the type of cache to be operated according to the correspondence between the preset cache type and the exception handling strategy; The exception handling strategy corresponding to the type of the cache to be operated is determined as the exception handling strategy for cache data of the cache to be operated.

6. The method according to any one of claims 3 to 5, characterized in that: The determining the type of the cache to be operated includes: When the cache to be operated is used to store data in the memory of the CPU, determining that the type of the cache to be operated is a CPU cache; When the cache to be operated is used to store data in the browser, determining that the type of the cache to be operated is a browser cache; When the cache to be operated is used to store data in a CDN, determining that the type of the cache to be operated is a CDN cache; When the cache to be operated is used to store data in a database, it is determined that the type of the cache to be operated is a database cache.

7. The method according to claim 1, characterized in that The processing of the cache to be operated according to the CRUD operation and the operation position includes: When the CRUD operation is an insert operation to insert data, adding the insert data to the operation position; When the CRUD operation is a delete operation, the cached data at the operation location is deleted.

8. An electronic device, characterized in that: include: The first acquisition module is used to acquire the CRUD operation for the cache to be operated; A second acquisition module is used to acquire, from a preset cache factory, an entry and exit rule generated for the cache data of the cache to be operated; A determination module, used to determine the operation position of the CRUD operation from the cache to be operated according to the entry and exit rules; A processing module, used for processing the cache to be operated according to the CRUD operation and the operation position; A third acquisition module is used to capture the operation information of the cache to be operated by using the slice technology; When the operation information contains operation information of a specific operation, a first prompt information is generated; wherein the first prompt information is used to prompt that a specific operation has occurred in the cache to be operated; when the operation information contains information used to indicate that a specific exception has occurred, a second prompt information is generated; wherein the second prompt information is used to prompt that a specific exception has occurred in the cache to be operated.

9. An electronic device, characterized in that: include: A processor and a storage medium storing instructions executable by the processor, wherein the storage medium relies on the processor to perform operations through a communication bus, and when the instructions are executed by the processor, the cache processing method described in any one of claims 1 to 7 is executed.

10. A computer storage medium, characterized in that: Executable instructions are stored, and when the executable instructions are executed by one or more processors, the processors execute the cache processing method described in any one of claims 1 to 7.

Citation Information

Patent Citations

  • Progressive cache elimination method and device, electronic equipment and storage medium

    CN112487029A