A configurable credit accounting method, system and electronic device with Redis

By using Redis as an unstructured database in financial systems, combined with idempotent attribute parameter configuration tables and custom annotations, the problem of acquiring transaction data in high-concurrency scenarios is solved, fast verification and efficient processing are achieved, and the stability and reliability of the system are improved.

CN118796308BActive Publication Date: 2025-09-23WUHAN ZBANK CO LTD
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202410856219.5
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-06-28
Publication Date
2025-09-23
Estimated Expiration
2044-06-28

AI Technical Summary

Technical Problem

The existing financial system has difficulty in quickly obtaining the main information elements of transaction data in high-concurrency scenarios, resulting in data disorder and deviation in results, affecting fund settlement and reputation.

Method used

Redis is used as an unstructured database. By creating a new idempotent attribute parameter configuration table and custom idempotent annotations, combined with aspect technology, rapid verification and cache management of transaction data can be achieved, reducing dependence on physical databases.

Benefits of technology

It improves the system's processing efficiency and reliability, reduces hardware and network resource usage, simplifies system processes, enhances the system's high concurrency and robustness, and reduces maintenance difficulty.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN118796308B_ABST
    Figure CN118796308B_ABST
Patent Text Reader

Abstract

The present invention provides a configurable credit accounting method, system, and electronic device in combination with Redis. The method comprises: step 1: creating an idempotency attribute parameter configuration table; including: an idempotency keyword, an idempotency switch, a repeatable transaction flag, a cache timeout value, a cache timeout unit, and a transaction scenario attribute column; step 2: creating a custom idempotency annotation; step 3: creating a new section that cross-cuts the idempotency annotation; step 4: querying the idempotency attribute parameter configuration table and preheating the query results through Redis; step 5: obtaining configuration information from Redis based on the scenario code and dynamically injecting the annotation; step 6: configuring the annotation on the transaction method that needs to be configured based on the transaction scenario; and step 7: when the configured expiration time is reached, Redis automatically deletes the cached transaction information. The present invention uses Redis as an unstructured database for idempotency verification to solve the problem of quickly obtaining the main information elements of transaction data, thereby realizing real-time interception verification of the system.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present invention relates to the field of computer technology for financial institutions, and in particular to a configurable credit accounting method, system, and electronic device in combination with Redis. Background Art

[0002] With the rapid development of society, people's demand for funds is increasing. Whether it's a small purchase of water or a large purchase of a house, banks' credit accounting systems are indispensable. Consequently, these systems are subject to enormous service traffic. With this exponential increase in service inflow, traditional monolithic system architectures are no longer able to meet the demands of multi-user, high-concurrency mobile operations. While microservice cluster architectures maintain system availability, data consistency and reliability cannot be guaranteed. This severely impacts the normal operation of core business operations and leads to numerous data governance issues.

[0003] Most existing financial systems still determine whether a transaction has already occurred by querying physical tables based on the key information elements of a request. When the number of requests is small, this query method can resolve and intercept duplicate transactions. However, if multiple requests with the same elements are made concurrently within a given timeframe, the system will fail to intercept them. This can lead to data disorganization and poor data quality during the system's processing of transactions based on the requested elements. In scenarios involving monetary calculations, this can lead to significant deviations in the resulting amounts, ultimately impacting fund settlement and causing losses to the financial institution's capital, reputation, and goodwill.

[0004] The current approach is to query physical tables for records to determine whether a transaction has already occurred. If the physical table data volume is too large or the relevant fields lack an indexing mechanism, query times can be excessive, and identical transactions cannot be identified within a single request. In high-concurrency scenarios, the system's capacity is weakened, and system interception can lead to blindness, making it impossible to identify identical transactions. This ultimately leads to misaligned transaction data and skewed results. Therefore, rapidly acquiring the key information element of transaction data is crucial to resolving this issue. Summary of the Invention

[0005] In response to the technical problems existing in the prior art, the present invention provides a configurable credit accounting method, system and electronic device in combination with Redis, which are used to solve the problem of quickly obtaining the main information elements of transaction data in the prior art and realize real-time interception and verification.

[0006] According to a first aspect of the present invention, the present invention provides a configurable credit accounting method using Redis, comprising the following steps:

[0007] Step 1: Create an idempotency attribute parameter configuration table, including: idempotency keyword, idempotency switch, repeatable transaction flag, cache timeout value, cache timeout unit, and transaction scenario attribute columns;

[0008] Step 2: Create a custom idempotent annotation;

[0009] Step 3: Create a new aspect around the idempotent annotation;

[0010] Step 4: Query the idempotent attribute parameter configuration table and preheat the query results through Redis;

[0011] Step 5: Get configuration information from Redis based on the scenario code and dynamically inject annotations;

[0012] Step 6: Configure annotations on the transaction methods that need to be configured based on the transaction scenario;

[0013] Step 7: When the configured expiration time is reached, Redis automatically deletes the cached transaction information.

[0014] On the basis of the above technical solution, the present invention can also make the following improvements.

[0015] Optionally, the idempotent attribute parameter configuration table is initialized and configured according to the requirements of the transaction scenario, and the configuration is loaded into the Redis cache when the system is running to reduce frequent database interactions.

[0016] Optionally, the idempotent annotation increases system resilience by setting default values ​​for the annotation during the establishment process according to the differences in the running systems and the running conditions, and personalizes the annotation properties according to the characteristics of different systems to meet the differentiated needs of different systems.

[0017] Optionally, the newly created aspect and the surrounding cross-cutting idempotent annotation include:

[0018] Create a new Java class for the aspect and create a surrounding aspect method;

[0019] When the status is "duplicate transactions are not allowed", the value of the corresponding transaction information is obtained according to the annotation attribute keyword. After assembling the primary key, the data is checked in Redis to determine whether the relevant transaction information is already in the cache. If it is not in the cache, the timeout period is calculated based on the attributes time and unit, and the transaction data is stored in the cache and the timeout period is set.

[0020] If there is a cache, the transaction result in the cache is retrieved and returned.

[0021] Optionally, querying the idempotent attribute parameter configuration table and preheating the query results through Redis includes: when the system starts, querying the database parameter configuration table, assembling the obtained results into a newly added model, and using hash type data to store the model data in Redis; wherein the key set is the scene, and the value is the Json type data of the model;

[0022] Dynamically adjust the parameter acquisition and loading methods according to the characteristics of the system, and evaluate which method is more suitable for the operation of the system based on the actual situation of the system.

[0023] Optionally, the loading form is not limited to obtaining configuration information from a table structure, and the configuration information may also be obtained in a configuration file form or static parameters when the system is started and loaded into the cache.

[0024] Optionally, obtain configuration information from Redis based on the scenario code, and dynamically inject annotations including:

[0025] Match the transaction scenario code value in Redis according to the system class attributes to obtain the corresponding configuration parameter JSON type data and convert it into a model;

[0026] Use Redis cache to obtain configuration information, and dynamically inject the obtained model attribute parameters into the corresponding fields of the Annotation; the Annotation attribute injection can be obtained from configuration files and static parameters, or combined in multiple ways to meet the needs of different differentiated systems.

[0027] Optionally, configuring annotations on transaction methods that need to be configured according to transaction scenarios includes:

[0028] Parameters are loaded from Redis into idempotent annotation properties. Annotations can be flexibly configured according to transaction scenarios. Initial transaction scenario parameters are loaded into Redis through configuration files, physical databases, or static system parameters when the system service starts. The cache is automatically refreshed after the configuration parameters are updated in real time.

[0029] According to a second aspect of the present invention, a configurable credit accounting system using Redis is provided, comprising:

[0030] A system parameter establishment module is used to create an idempotency attribute parameter configuration table; the idempotency attribute parameter configuration table includes an idempotency keyword, an idempotency switch, a repeatable transaction flag, a cache timeout value, a cache timeout unit, and a transaction scenario attribute column; and to create a custom idempotency annotation; and to create a new aspect that surrounds and cross-cuts the idempotency annotation.

[0031] The system parameter calling module is used to query the idempotent attribute parameter configuration table and preheat the query results through Redis; obtain the configuration information from Redis and inject it into the annotation attribute; configure the annotation on the transaction method that needs to be configured according to the transaction scenario;

[0032] The system parameter processing module is used to automatically delete cached transaction information in Redis when the configured expiration time is reached.

[0033] The present invention also provides an electronic device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the program, it implements a configurable credit accounting method in combination with Redis as described above.

[0034] The technical effects and advantages of the present invention are as follows:

[0035] The present invention provides a configurable credit accounting method, system, and electronic device using Redis. Redis is used as an unstructured database with idempotent verification. This method has higher read and write speeds than physical storage, resulting in higher system processing efficiency, reduced frequent physical database queries, freed up more hardware and network resources, and reduced application CPU pressure.

[0036] Using annotations makes configuration easier, reduces duplicate logic, improves system readability, and simplifies system processing. It also improves the system's high concurrency, high availability, and robustness, reduces various risks brought about by the use of physical storage verification, and thus improves system quality.

[0037] Annotation parameter configuration allows parameters to be adjusted dynamically and flexibly according to different idempotence requirements. It can be updated in real time, improving the system's configurability and reducing the difficulty of subsequent maintenance.

[0038] Other features and advantages of the present invention will be described in the following description, and in part will become apparent from the description, or will be understood by practicing the present invention. The purpose and other advantages of the present invention can be realized and obtained by the structures pointed out in the description, claims and drawings. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] Figure 1 This is a flowchart of a configurable credit accounting method using Redis provided by an embodiment of the present invention;

[0040] Figure 2 This is a schematic diagram of a summary flow of a request path provided by an embodiment of the present invention;

[0041] Figure 3 This is a flow chart of the Aspect internal logic method provided by an embodiment of the present invention;

[0042] Figure 4 Schematic diagram of the flow of configuration data transfer method provided by an embodiment of the present invention;

[0043] Figure 5 The figure is a flow chart of a method for acquiring and converting data from a cache provided by an embodiment of the present invention. DETAILED DESCRIPTION

[0044] To make the objectives, technical solutions, and advantages of the present invention more clear, the technical solutions of the present invention will be clearly and completely described below in conjunction with the accompanying drawings. Obviously, the embodiments described are only some embodiments of the present invention, not all embodiments. Based on the embodiments of the present invention, all other embodiments obtained by ordinary technicians in this field without making creative efforts shall fall within the scope of protection of the present invention.

[0045] In order to solve the problem of quickly obtaining the main information elements of transaction data, the embodiment of the present invention introduces the unstructured database Redis as a storage for key combination data.

[0046] It's important to note that Redis is an in-memory database with high read and write speeds, a rich data type, and easy deployment. Therefore, it offers a significant inherent advantage in read performance compared to physical disk-based databases. Furthermore, during transactions, only key request information elements need to be stored, resulting in a relatively small memory footprint. However, to prevent the in-memory database from increasing in memory usage as transaction volume and accumulation increase, an expiration time is set for each transaction. The system is implemented in Java, an object-oriented programming language that makes it easier to understand, develop, and maintain.

[0047] It is understandable that based on the defects in the background technology, the embodiment of the present invention proposes a configurable credit accounting method with Redis, specifically Figure 1 As shown, the calculation method includes the following implementation steps:

[0048] Step 1: Create a new idempotency parameter configuration table. This table contains the idempotency keyword (key), the idempotency switch (switch), the repeatable transaction flag (repeat), the cache timeout value (time), the cache timeout unit (unit), and the transaction scenario attribute column. You can also expand the configuration parameter table based on actual conditions to suit the operation of the corresponding system.

[0049] The idempotency parameter configuration table is initialized based on transaction scenario requirements and loaded into the Redis cache during system runtime to reduce frequent database interactions. Idempotency parameter configuration isn't limited to physical tables; configuration files and static parameters are also possible. Different configuration strategies can be employed to meet varying needs.

[0050] Through the above technical solution, the common parts are extracted through annotations, and a set of logic is used to intercept according to easy keywords with different configurations; the code intrusion is low.

[0051] Step 2: Create a custom idempotent annotation. The annotation contains the idempotent keyword key, the idempotent switch switch, the repeat flag indicating whether the transaction can be repeated, the cache timeout value time, the cache timeout unit unit, and the transaction scenario scene.

[0052] In the above technical solution, default values ​​can be set for annotations during the creation process to increase system resilience, depending on the differences in operating systems and operational conditions. For example, default settings such as key = loanNo, switch = Y, repeat = N, time = 90, unit = s, and scene = repay can be used. Based on this, annotation attributes can be customized to meet the differentiated needs of different systems. For example, a maximum number of daily transaction requests can be added, and a transaction failure signal can be returned if the maximum number of requests is reached.

[0053] The above implementation steps can reduce frequent database interactions when using Redis.

[0054] Step 3: Create a new aspect around the idempotent annotations mentioned above; when a transaction request passes through, first perform a pre-check through the aspect;

[0055] For details of the specific process, please refer to the attached Figure 2 and attached Figure 3 As shown in the figure, the specific implementation process of creating a new aspect and surrounding the cross-cutting idempotent annotation is as follows:

[0056] 3.1. Create a new Aspect Java class;

[0057] 3.2. Establish the surrounding section method Method; the specific logic of Method is as follows:

[0058] 3.2.1. Determine whether the annotation switch is turned on to determine whether to use annotation-related parameters for data interception and verification. If the switch is not turned on, the communication process will proceed directly without going through the idempotent interception and verification logic;

[0059] 3.2.2. Determine whether the transaction is repeatable. If it is, proceed directly with the transaction without going through the idempotent interception and verification logic.

[0060] 3.3. When the repeat status is set to not allow repeated transactions, the value of the corresponding transaction information is obtained based on the annotation attribute keyword key. After assembling the primary key, the Redis database is queried to determine whether the data exists to determine whether the relevant transaction information is already in the cache. If not, the timeout period is calculated based on the attributes time and unit, the transaction data is stored in the cache, and the timeout period is set. If the cache exists, the transaction result in the cache is retrieved and returned.

[0061] In the above implementation steps, the newly created aspects can add some specialized processing according to the characteristics of different systems. It is not just verification and interception. Some additional functions can be added during the cross-cutting process, such as adding printing of request start and end times in the cross-cutting logic or distributing and calling other system interfaces, etc. Specific changes need to be made according to the needs of different systems.

[0062] Through the above implementation steps, you can configure the cache parameters for Redis as a cache database to achieve efficient reading and writing.

[0063] Step 4: Query the idempotent attribute parameter configuration table and preheat the query results through Redis;

[0064] Figure 4 This is a flow chart of the configuration data transfer method provided by an embodiment of the present invention, refer to the attached Figure 4 As shown, the specific implementation process of querying the idempotent attribute parameter configuration table is as follows:

[0065] 4.1. When the system starts, query the database parameter configuration table;

[0066] 4.2. Assemble the obtained results into the newly added model;

[0067] 4.3. Use the hash type data type to store model data in Redis, where the key is set to the scene and the value is the Json type data of the model, and the parameters are placed in Redis.

[0068] Implementation of the aforementioned aspects involves caching request information. The current request is compared with the cached information for keywords, and the current request information is saved. Configuration loading isn't limited to retrieving configuration information from a table structure. Configuration information can also be retrieved and loaded into the cache at system startup using configuration files or static parameters. Parameter retrieval and loading methods can be dynamically adjusted based on system characteristics. Preheating can also involve lazy loading, where data is queried from the database and loaded into the Redis cache only when needed. Based on the system's actual conditions, evaluate which method best suits system operation.

[0069] Step 5: Get configuration information from Redis based on the scenario code and dynamically inject annotations;

[0070] Figure 5 This is a flow chart of a method for obtaining and converting data from a cache provided by an embodiment of the present invention. Figure 5 As shown, the specific implementation process of obtaining configuration information from Redis according to the scenario code and dynamically injecting annotations is as follows:

[0071] 5.1. Get the scene type of the configuration annotation Java class;

[0072] 5.2. Get the Json type data of the corresponding attributes from Redis according to the scene type;

[0073] 5.3. Convert JSON type data into model;

[0074] 5.4. Dynamically inject model attribute values ​​into Annotation.

[0075] In the above technical solution, step 5 is to obtain the configuration injection annotation attributes from the cache to realize dynamic configuration annotation; the main function of the transaction scene is to obtain the corresponding configuration parameter JSON type data according to the system class attribute matching the transaction scene code value in Redis and convert it into a model, and at the same time dynamically inject the obtained model attribute parameters into the corresponding fields of the Annotation, to maximize support for the system to implement changes only through configuration, and reduce the risks brought by frequent code changes. The use of Redis cache to obtain configuration is mainly to reduce frequent database queries and improve system processing efficiency. Annotation attribute injection can be obtained from configuration files or static parameters, or a combination of multiple methods can be used to meet the needs of different differentiated systems.

[0076] Step 6: Configure annotations on the transaction methods that need to be configured based on the transaction scenario;

[0077] In the above technical solution, based on system requirements and the diverse nature of different transaction scenarios, annotations tailored to each transaction scenario need to be configured on each method. When a transaction request is received, the annotation's aspect is first processed. Multiple annotations can be configured on the same method, such as those for logging or request statistics. This implementation utilizes a configuration approach, resulting in minimal code intrusion. Later, when no longer needed, idempotency can be disabled through configuration, or the system can be taken offline with minimal changes.

[0078] Step 7: When the configured expiration time is reached, Redis automatically deletes the cached transaction information.

[0079] This implementation step is to automatically delete expired data, eliminating the need for additional program cleanup. Specifically, the parameter configuration includes time and unit. When a transaction request comes in, Redis will set an expiration time based on the configuration. When the configured expiration time is reached, Redis will automatically delete the stored data. The unit can be hour, minute, second, or millisecond. Multiple unit types are supported to meet the different needs of the system. Multiple types of configuration settings make the system more robust. The idempotence time of different transactions needs to be determined based on the transaction characteristics and the hardware configuration to avoid incorrect settings that cause the system to run slowly or crash. Finally, determine which business processes in the system have high concurrency and perform annotation configuration to avoid duplicate transactions.

[0080] In summary, the embodiment of the present invention uses Redis as an unstructured database for idempotency verification. Its read and write speeds are higher than those of physical storage, which improves system processing efficiency, reduces frequent physical database queries, frees up more hardware and network resources, and reduces application CPU pressure.

[0081] Using annotations makes configuration easier, reduces duplicate logic, improves system readability, and simplifies system processing. It also improves the system's high concurrency, high availability, and robustness, reduces various risks brought about by the use of physical storage verification, and thus improves system quality.

[0082] Annotation parameter configuration allows parameters to be adjusted dynamically and flexibly according to different idempotence requirements. It can be updated in real time, improving the system's configurability and reducing the difficulty of subsequent maintenance.

[0083] According to a second aspect of the present invention, a configurable credit accounting method system using Redis is provided, comprising:

[0084] A system parameter establishment module is used to create an idempotency attribute parameter configuration table; the idempotency attribute parameter configuration table includes an idempotency keyword, an idempotency switch, a repeatable transaction flag, a cache timeout value, a cache timeout unit, and a transaction scenario attribute column; and to create a custom idempotency annotation; and to create a new aspect that surrounds and cross-cuts the idempotency annotation.

[0085] The system parameter calling module is used to query the idempotent attribute parameter configuration table and preheat the query results through Redis; obtain the configuration information from Redis and inject it into the annotation attribute; configure the annotation on the transaction method that needs to be configured according to the transaction scenario;

[0086] The system parameter processing module is used to automatically delete cached transaction information in Redis when the configured expiration time is reached.

[0087] It can be understood that the Redis configurable credit accounting system provided by the present invention corresponds to the Redis configurable credit accounting method provided by the aforementioned embodiments. The relevant technical features of a Redis configurable credit accounting system can refer to the relevant technical features of a Redis configurable credit accounting method, which will not be repeated here.

[0088] Additionally, an embodiment of the present invention provides an electronic device comprising: a processor, a communications interface, a memory, and a communications bus, wherein the processor, the communications interface, and the memory communicate with each other via the communications bus. The processor can invoke logic instructions in the memory to execute the steps of the aforementioned configurable credit accounting method using Redis.

[0089] In addition, the logical instructions in the above-mentioned memory can be implemented in the form of a software functional unit and can be stored in a computer-readable storage medium when sold or used as an independent product. Based on this understanding, the technical solution of the present invention, or the part that contributes to the prior art, or the part of the technical solution, can be embodied in the form of a software product. The computer software product is stored in a storage medium and includes several instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute all or part of the steps of the method described in each embodiment of the present invention. The aforementioned storage medium includes: various media that can store program codes, such as a USB flash drive, a mobile hard disk, a read-only memory (ROM), a random access memory (RAM), a magnetic disk or an optical disk.

[0090] The device embodiments described above are merely illustrative. The units described as separate components may or may not be physically separate, and the components shown as units may or may not be physical units, i.e., they may be located in one location or distributed across multiple network units. Some or all of the modules may be selected based on actual needs to achieve the objectives of the present embodiment. Persons of ordinary skill in the art will be able to understand and implement the present invention without inventive effort.

[0091] Through the description of the above embodiments, those skilled in the art can clearly understand that each embodiment can be implemented by means of software plus a necessary general hardware platform, or of course, by hardware. Based on this understanding, the essence of the above technical solution or the part that contributes to the existing technology can be embodied in the form of a software product. The computer software product can be stored in a computer-readable storage medium, such as ROM / RAM, a magnetic disk, an optical disk, etc., and includes a number of instructions for enabling a computer device (which can be a personal computer, a server, or a network device, etc.) to execute the methods described in each embodiment or certain parts of the embodiments.

[0092] Although the preferred embodiments of the present invention have been described, those skilled in the art may make additional changes and modifications to these embodiments once they have learned the basic creative concept. Therefore, the appended claims are intended to be interpreted as including the preferred embodiments and all changes and modifications that fall within the scope of the present invention.

[0093] Finally, it should be noted that the above embodiments are only used to illustrate the technical solutions of the present invention, rather than to limit it. Although the present invention has been described in detail with reference to the aforementioned embodiments, those skilled in the art should understand that they can still modify the technical solutions described in the aforementioned embodiments, or make equivalent replacements for some of the technical features therein. However, these modifications or replacements do not deviate the essence of the corresponding technical solutions from the spirit and scope of the technical solutions of the various embodiments of the present invention.

Claims

1. A configurable credit accounting method using Redis, characterized in that: The following steps are involved: Step 1: Create an idempotency attribute parameter configuration table; including: idempotency keyword, idempotency switch, repeatable transaction flag, cache timeout value, cache timeout unit, and transaction scenario attribute columns; Step 2: Create a custom idempotent annotation; Step 3: Create a new aspect around the idempotent annotation; Step 4: Query the idempotent attribute parameter configuration table and preheat the query results through Redis; Step 5: Get configuration information from Redis based on the scenario code and dynamically inject annotations; Step 6: Configure annotations on the transaction methods that need to be configured based on the transaction scenario; Step 7: When the configured expiration time is reached, Redis automatically deletes the cached transaction information.

2. A configurable credit accounting method with Redis according to claim 1, characterized in that: The idempotent attribute parameter configuration table is initialized and configured according to the requirements of the transaction scenario, and the configuration is loaded into the Redis cache when the system is running to reduce frequent database interactions.

3. A configurable credit accounting method with Redis according to claim 1, characterized in that: The idempotent annotation increases system resilience by setting default values ​​for the annotation during the establishment process according to the differences and operating conditions of the running systems, and personalizes the annotation properties according to the characteristics of different systems to meet the differentiated needs of different systems.

4. A configurable credit accounting method with Redis according to claim 1, characterized in that: The newly created aspect, surrounding the cross-cutting idempotent annotation, includes: Create a new Java class for the aspect and create a surrounding aspect method; When the status is "duplicate transactions are not allowed", the value of the corresponding transaction information is obtained based on the annotation attribute keyword. After assembling the primary key, the data is checked in Redis to determine whether the relevant transaction information is already in the cache. If it is not in the cache, the timeout period is calculated based on the attributes time and unit, and the transaction data is stored in the cache and the timeout period is set. If there is a cache, the transaction result in the cache is retrieved and returned.

5. The Redis configurable credit accounting method according to claim 1, characterized in that: The query result of querying the idempotent attribute parameter configuration table through Redis preheating includes: When the system starts, query the database parameter configuration table, assemble the obtained results into the newly added model, and use hash type data to store the model data in Redis; the key set is the scene, and the value is the Json type data of the model; Dynamically adjust the parameter acquisition and loading methods according to the characteristics of the system, and evaluate which method is more suitable for the operation of the system based on the actual situation of the system.

6. A configurable credit accounting method with Redis according to claim 5, characterized in that: The loading method is not limited to obtaining configuration information from a table structure, and configuration information can also be obtained in the form of a configuration file or static parameters when the system is started and loaded into the cache.

7. The method of claim 1, wherein: Get configuration information from Redis based on the scenario code, and dynamically inject annotations including: Match the transaction scenario code value in Redis according to the system class attributes to obtain the corresponding configuration parameter JSON type data and convert it into a model; Use Redis cache to obtain configuration information, and dynamically inject the obtained model attribute parameters into the corresponding fields of the Annotation; the Annotation attribute injection can be obtained from configuration files and static parameters, or combined in multiple ways to meet the needs of different differentiated systems.

8. A configurable credit accounting method with Redis according to claim 7, characterized in that: The configuration of annotations on the transaction methods that need to be configured according to the transaction scenario includes: Parameters are loaded from Redis into idempotent annotation properties. Annotations can be flexibly configured according to transaction scenarios. Initial transaction scenario parameters are loaded into Redis through configuration files, physical databases, or static system parameters when the system service starts. The cache is automatically refreshed after the configuration parameters are updated in real time.

9. A configurable credit accounting system with Redis, characterized by: include: A system parameter establishment module is used to create an idempotency attribute parameter configuration table; the idempotency attribute parameter configuration table includes an idempotency keyword, an idempotency switch, a repeatable transaction flag, a cache timeout value, a cache timeout unit, and a transaction scenario attribute column; and to create a custom idempotency annotation; and to create a new aspect that surrounds and cross-cuts the idempotency annotation. The system parameter calling module is used to query the idempotent attribute parameter configuration table and preheat the query results through Redis; obtain the configuration information from Redis and inject it into the annotation attribute; configure the annotation on the transaction method that needs to be configured according to the transaction scenario; The system parameter processing module is used to automatically delete cached transaction information in Redis when the configured expiration time is reached.

10. An electronic device comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, wherein: When the processor executes the program, it implements a configurable credit accounting method with Redis as described in any one of claims 1 to 8.

Citation Information

Patent Citations

  • Method, device, equipment for realizing business idempotence, and medium

    CN113703831A

  • Idempotent implementation method and device, computer equipment and storage medium

    CN116821587A