Product quota checking method and device based on cache index and computer device
By using a cache-based indexing approach and leveraging the collaborative work of Redis and the database, the problem of high database access pressure was solved, the efficiency of verifying and deducting the credit limit of financial products was improved, and data consistency and high-concurrency transaction processing were achieved.
Patent Information
- Authority / Receiving Office
- CN · China
- Patent Type
- Patents(China)
- Current Assignee / Owner
- CHINA CITIC BANK CO LTD
- Filing Date
- 2022-12-08
- Publication Date
- 2026-05-12
AI Technical Summary
In existing technologies, the query and verification of sales quotas for wealth management products rely on a database, resulting in low database execution efficiency, high access pressure, and complex quota control rules that require multiple queries, increasing the frequency of database access.
A cache-based indexing approach is adopted. The node index of the product quota requirement is obtained through Redis. After the first verification, the initial node is used to access the database for the second verification. The quota is deducted in the database and the cache is updated asynchronously, reducing direct access to the database.
It improved the efficiency of product sales quota verification and deduction, ensured data reliability and consistency, reduced the number of database accesses, alleviated access pressure, and improved the concurrency and transaction response speed of financial product sales.
Smart Images

Figure CN116362889B_ABST
Abstract
Description
Technical Field
[0001] This article relates to the field of computer science, and in particular to a product quota verification method, device, and computer equipment based on cache indexing. Background Technology
[0002] Storing product sales figures in a database to ensure data reliability and consistency is a common practice in the financial industry.
[0003] Currently, the sale of wealth management products relies solely on database access for sales quota queries, verification, and quota deductions. This process results in low database efficiency and high database access pressure. Furthermore, the sales quota control rules for wealth management products are complex, requiring multiple queries to locate the target node, leading to frequent database access.
[0004] To address the issues of low database execution efficiency and high access pressure in current technologies, a product quota verification method and device based on cache indexes are needed. Summary of the Invention
[0005] To address the problems of the prior art, this embodiment provides a product quota verification method, apparatus, and computer device based on cache index.
[0006] This embodiment provides a product quota verification method based on cached indexes. The method includes: obtaining a user-initiated product quota request, the product quota request including a product code and a product quota request value; obtaining a node index returned by Redis that satisfies the product quota request, the node index including at least one node that satisfies the product quota request, the remaining quota of the node, and the address of the node; performing a first verification on at least one node in the node index to obtain a unique initial node matching the product quota request; accessing the database using the initial node, the database performing a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions; if the product quota deduction conditions are met, determining the initial node as a node to be deducted, and performing quota deduction on the node to be deducted in the database; if the product quota deduction conditions are not met, selecting other nodes besides the initial node from the node index as new unique initial nodes, and iteratively determining whether the new unique initial nodes meet the product quota deduction conditions; if so, performing quota deduction on the new unique initial nodes in the database; asynchronously updating the node information after quota deduction in the database to Redis, and repeating the aforementioned steps.
[0007] According to one aspect of the embodiments herein, obtaining the node index returned by Redis that satisfies the quota query requirement includes: determining a first node containing the product code from a pre-configured list of nodes with remaining quota based on the product code; selecting a node from the first node whose remaining quota value is greater than or equal to the quota requirement value as a second node; and determining the node index based on the product code, the address of the second node, and the remaining quota value of each second node.
[0008] According to one aspect of the embodiments herein, determining a node index based on the product code, the address of the second node, and the remaining quota value of each second node includes: determining the hierarchical structure of the node index based on the product code and the address of the second node; and determining the node information in the structure of the index based on the product code, the address of the second node, and the remaining quota value of each second node.
[0009] According to one aspect of the embodiments herein, performing a first verification on at least one node in the node index to obtain an initial node matching the product quota requirement includes: selecting any one of the nodes in the node index whose difference between the remaining quota and the product quota requirement exceeds a preset threshold, as the initial node.
[0010] According to one aspect of the embodiments herein, the method further includes: selecting any one of the nodes whose product sales history is lower than a preset threshold from the node index as the initial node, based on the number of product sales history of the node.
[0011] According to one aspect of the embodiments herein, the initial node accesses the database, and the database performs a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions. This includes: determining whether the remaining quota value of the initial node in the database is greater than or equal to the product quota requirement value; if yes, then the initial node is determined to have passed the second verification and meets the product quota deduction conditions; if no, then the initial node is determined to have failed the second verification and cannot meet the product quota deduction conditions.
[0012] According to one aspect of the embodiments herein, the method further includes: after deducting the amount from the node to be deducted in the database, updating the remaining amount of the node to be deducted; and asynchronously synchronizing the updated node information to Redis.
[0013] According to one aspect of the embodiments herein, the method further includes: after deducting the amount from the node to be deducted in the database, storing the user's account balance and the user's product transaction amount in the database.
[0014] This embodiment also provides a product quota verification device based on cached indexes. The device includes: a product quota demand acquisition unit, used to acquire a product quota demand initiated by a user, the product quota demand including a product code and a product quota demand value; a node index acquisition unit, used to acquire a node index returned by Redis that satisfies the product quota demand, the node index including at least one node that satisfies the product quota demand, the remaining quota of the node, and the address of the node; a supermarket node determination unit, used to perform a first verification on at least one node in the node index to obtain a unique initial node that matches the product quota demand; and a judgment unit, used to access the database using the initial node, and have the database determine the initial node. The node performs a second verification to determine whether the initial node meets the product quota deduction conditions; the quota deduction unit is used to determine the initial node as the node to be deducted if the product quota deduction conditions are met, and to perform quota deduction on the node to be deducted in the database; the new unique initial node selection unit is used to select other nodes besides the initial node from the node index as new unique initial nodes if the product quota deduction conditions are not met, and to iteratively determine whether the new unique initial node meets the product quota deduction conditions, and if so, to perform quota deduction on the new unique initial node in the database; the node information update unit is used to asynchronously update the node information after quota deduction in the database to Redis, and to iteratively repeat the above steps.
[0015] This embodiment provides a computer device, including a memory, a processor, and a computer program stored in the memory and executable on the processor. When the processor executes the computer program, it implements the blockchain-based fund supervision method.
[0016] This embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, implements the product quota verification method based on cache index.
[0017] This solution improves the efficiency of product sales quota verification and deduction under complex product sales quota control rules, while ensuring data reliability and consistency. It also effectively reduces the number of times the application accesses the database, alleviating database access pressure. This can increase the concurrency of financial product sales, reduce the response time of each transaction, and thus increase the number of transactions processed per second by the system. Attached Figure Description
[0018] To more clearly illustrate the technical solutions in the embodiments or prior art described herein, the accompanying drawings used in the description of the embodiments or prior art will be briefly introduced below. Obviously, the accompanying drawings described below are only some embodiments of this article. For those skilled in the art, other drawings can be obtained based on these drawings without creative effort.
[0019] Figure 1 The diagram shown is a flowchart of a product quota verification method based on cache index in an embodiment of this paper.
[0020] Figure 2 The diagram shown is a flowchart of a method for obtaining a node index according to an embodiment of this paper;
[0021] Figure 3 The diagram shown is a flowchart of a method for determining whether an initial node meets the conditions for deducting product quota according to an embodiment of this article.
[0022] Figure 4 The diagram shown is a flowchart of an information synchronization method according to an embodiment of this paper;
[0023] Figure 5 The diagram shown is a structural schematic of a product quota verification device based on cache index according to an embodiment of this paper.
[0024] Figure 6 The diagram shown is a schematic representation of the specific structure of the product quota verification device based on cache index in this embodiment.
[0025] Figure 7 The diagram shown is a schematic diagram of a product quota verification method according to an embodiment of this article;
[0026] Figure 8 The diagram shown is a structural schematic of a computer device according to an embodiment of this article.
[0027] Explanation of symbols in the attached drawings:
[0028] 501. Product Quota Requirement Acquisition Unit;
[0029] 502. Node Index Acquisition Unit;
[0030] 5021, First Node Determination Module;
[0031] 5022, Second Node Determination Module;
[0032] 503. Initial Node Determination Unit;
[0033] 504. Judgment Unit;
[0034] 505, Quota Deduction Unit;
[0035] 506. New unique initial node selection unit;
[0036] 507. Node Information Update Unit;
[0037] 802. Computer equipment;
[0038] 804, Processor;
[0039] 806. Memory;
[0040] 808. Drive mechanism;
[0041] 810. Input / Output Module;
[0042] 812. Input devices;
[0043] 814. Output devices;
[0044] 816. Presentation equipment;
[0045] 818. Graphical User Interface;
[0046] 820. Network interface;
[0047] 822. Communication link;
[0048] 824. Communication bus. Detailed Implementation
[0049] To enable those skilled in the art to better understand the technical solutions in this specification, the technical solutions in the embodiments herein will be clearly and completely described below with reference to the accompanying drawings. Obviously, the described embodiments are only a part of the embodiments herein, and not all of the embodiments. Based on the embodiments herein, all other embodiments obtained by those skilled in the art without creative effort are within the scope of protection of this document.
[0050] It should be noted that the terms "first," "second," etc., used in the specification, claims, and accompanying drawings herein are used to distinguish similar objects and are not necessarily used to describe a specific order or sequence. It should be understood that such data can be interchanged where appropriate so that the embodiments described herein can be implemented in orders other than those illustrated or described herein. Furthermore, the terms "comprising" and "having," and any variations thereof, are intended to cover a non-exclusive inclusion; for example, a process, method, apparatus, product, or device that comprises a series of steps or units is not necessarily limited to those steps or units explicitly listed, but may include other steps or units not explicitly listed or inherent to such processes, methods, products, or devices.
[0051] This specification provides the operational steps of the methods described in the embodiments or flowcharts, but based on conventional or non-inventive labor, more or fewer operational steps may be included. The order of steps listed in the embodiments is merely one possible execution order among many and does not represent the only possible execution order. In actual system or device products, the methods shown in the embodiments or drawings can be executed sequentially or in parallel.
[0052] It should be noted that the product credit limit verification method based on cache index in this paper can be used in the computer field as well as the financial field. This paper does not limit the application field of the product credit limit verification method and device based on cache index.
[0053] It should be noted that the acquisition, storage, use, and processing of data in the technical solution of this application all comply with the provisions of national laws and regulations.
[0054] Figure 1 The diagram shows a flowchart of a product quota verification method based on cache index, as described in this embodiment, which includes the following steps:
[0055] Step 101: Obtain the product credit limit request initiated by the user. The product credit limit request includes a product code and a product credit limit request value. The product credit limit request in this step is initiated by the user, indicating the user's desired product purchase. The product code can be a product number, product serial number, product model, etc., and the product credit limit request value is the quantity or credit limit of the product the user wants to purchase. In some embodiments of this specification, the product credit limit request also includes information such as the customer's transaction channel and the customer's affiliated branch. The customer's transaction channel includes mobile banking, online banking, etc., and the customer's affiliated branch information includes information about which branch the user currently belongs to.
[0056] Step 102: Obtain the node index returned by Redis that meets the product quota requirements. The node index includes at least one node that meets the product quota requirements, the remaining quota of the node, and the address of the node.
[0057] By accessing Redis, Redis returns node index data that meets the product quota requirements. The node index includes nodes for all sales products that meet the user's needs, and can be presented in table or directory form. Each node represents a sales product and can be an abstract representation of a physical sales outlet, sales counter, sales store, or sales counter. In this step, all nodes in the node index meet the user's product quota requirements, and the remaining quota of all nodes is greater than or equal to the user's product quota requirement. The node index also includes the remaining quota of each node and the address of each node. The address of a node is the location of the physical node in the node index within Redis. In some embodiments of this specification, when the product quota requirements include customer transaction channels and customer affiliated outlet information, by accessing Redis, Redis returns nodes for all sales products that meet the product code requirements, product quota requirements, customer transaction channels, and customer affiliated outlet information in the user's quota requirements, serving as the node index. This step will not be elaborated upon here.
[0058] Step 103: Perform a first verification on at least one node in the node index to obtain a unique initial node that matches the product credit limit requirement. In this step, the node index includes at least one node that meets the user's product credit limit requirement. When multiple nodes meet the user's credit limit requirement simultaneously, it is necessary to select one node from among the multiple nodes as the unique initial node. The process of determining the unique initial node is the process of performing the first verification.
[0059] In some embodiments of this specification, any one of the nodes whose remaining credit limit differs from the product credit limit requirement by a preset threshold is selected from the node index as the initial node. If the difference between the remaining credit limit and the product credit limit requirement of a node exceeds the preset threshold, it can be determined that the remaining credit limit of that node is relatively sufficient. Furthermore, during the process from the execution of the first verification to the subsequent credit limit deduction, there is a high probability that the remaining credit limit of that node, even after being deducted by other users, will still meet the current user's product credit limit requirement. Therefore, this node still has a high probability of meeting the current user's product credit limit requirement.
[0060] In some other embodiments of this specification, any node with a historical product sales count below a preset threshold can be selected from the node index as the initial node based on the node's historical product sales count. The historical product sales count of a node reflects its past sales performance. This step selects nodes with a historical product sales count below the preset threshold, meaning nodes that were not previously popular or sought after. For such nodes, the probability of their remaining credit being deducted by other users is lower and changes are less frequent during the process from the first verification to subsequent credit deduction. Therefore, these nodes have a greater chance of successfully deducting credit on the first attempt.
[0061] In other embodiments of this specification, the node closest to the user's current node can be found and used as the initial node. When multiple nodes simultaneously meet the user's product quota requirements, the node closest to the user's current node is selected as the unique initial node based on the node distribution structure or hierarchy.
[0062] Step 104: Access the database using the initial node, and have the database perform a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions.
[0063] In this step, the database stores data for all nodes in the node index except the initial node. Furthermore, the database can also store data for all preset nodes, not just the node-related data in the node index. The database also includes the remaining quota for all nodes and their addresses. In some embodiments of this specification, the database is accessed based on the initial node data returned by Redis. Because there may be a time delay between the data in the database and the data in Redis, and the data cannot be synchronized in real time, it is necessary to perform another verification on the initial node in the database to ensure that the initial node still meets the product quota deduction conditions in the database.
[0064] Step 105: If the product credit deduction conditions are met, the initial node is determined as the node to be deducted, and the credit deduction is performed on the node to be deducted in the database. After the credit deduction is performed on the node to be deducted, the credit limit of the node to be deducted changes.
[0065] Step 106: If the product quota deduction condition is not met, select a node other than the initial node from the node index as a new unique initial node. Iterate through the nodes to determine if the new unique initial node meets the product quota deduction condition. If so, deduct the quota from the new unique initial node in the database. When accessing the database using the initial node, during the second verification, the remaining quota of the initial node is inconsistent with its remaining quota in Redis. Specifically, the remaining quota of the initial node is less than its remaining quota in Redis and less than the user's product quota requirement. Therefore, the initial node cannot meet the user's needs, and a new node needs to be determined from the Redis node index as a new, unique initial node. The database is then accessed again using this new unique initial node, and the database performs a second verification to determine if the new unique initial node meets the quota deduction condition. If the quota deduction condition is met, the quota is deducted from the new unique initial node.
[0066] Step 107: Asynchronously update the node information after deducting the credit limit from the database to Redis. After the credit limit deduction for the initial node is completed in the database, the remaining credit limit of the initial node changes. The remaining credit limit information of the initial node and other node information are asynchronously synchronized to Redis via an asynchronous message service to ensure the accuracy of the credit limit query.
[0067] Figure 2 The diagram shown is a flowchart of a method for obtaining a node index according to an embodiment of this paper, which includes the following steps:
[0068] Step 201: Based on the product code, determine the first node containing the product code from the pre-configured nodes with remaining credit. In some embodiments of this specification, determining whether a node contains the required product code can determine whether the node has a product that meets the user's needs. In this step, the pre-configured nodes with remaining credit are pre-set by administrators according to business rules or management systems. For example, a portion of the credit is configured for multiple nodes in a certain region, another portion for multiple nodes in another region, and other credits for nodes at headquarters. When an actual transaction occurs, the credit of different nodes will change according to the actual transaction situation. If a credit deduction occurs, the current credit of the node can be referred to as the remaining credit.
[0069] This step first identifies nodes with the desired product from a pre-configured list of nodes with remaining credit. For example, if 8 out of 10 pre-configured nodes meet the credit query requirements, and 5 of these 8 nodes contain a product code, then 5 primary nodes are identified from the pre-configured list of 10 nodes.
[0070] Step 202: Select nodes from the first nodes whose remaining credit limit is greater than or equal to the credit limit requirement value, and designate them as second nodes. In this step, nodes whose remaining credit limit is greater than or equal to the user's credit limit requirement value are further selected from the first nodes. In some embodiments of this specification, only when the remaining credit limit value of a node is greater than or equal to the credit limit requirement value can the product corresponding to the user's needs be provided to satisfy the user's consumption needs. For example, if the remaining credit limit values of the five first nodes determined in step 201 are 10,000, 20,000, 15,000, 100,000, and 50,000 respectively, and the user's credit limit requirement value is 25,000, then it can be determined that the remaining credit limit values of three of the nodes do not meet the credit limit requirement, and the remaining credit limit values of two of the nodes meet the credit limit requirement value, and these can be designated as second nodes.
[0071] Step 203: Determine the node index based on the product code, the address of the second node, and the remaining quota value of each second node. The node index is determined based on the second nodes that meet the product quota requirements determined in steps 201 and 202, the addresses of the second nodes in Redis, the remaining quota value of each second node, and the product code. In some embodiments of this specification, the node index is a table providing address and content information of the node to be queried. The node index may include different hierarchical structures.
[0072] In one embodiment of this specification, the hierarchical structure of the node index is determined based on the product code and the address of the second node. The node information in the index structure is determined based on the product code, the address of the second node, and the remaining quota value of each second node.
[0073] In this specification, the node index comprises two hierarchical structures: Level 1 and Level 2. The information in Levels 1 and 2 is represented in key-value pairs. The data format in Level 1 is as follows: key: String product code, value: List product quota nodes; representing all remaining quotas, products that meet the user's quota requirements, and their node addresses. The data format in Level 2 is as follows: key: String product code + product quota node, value: Hash quota information; this level represents the specific node information of the nodes in Level 1.
[0074] Figure 3 The diagram shows a flowchart of a method for determining whether an initial node meets the product quota deduction conditions, as described in this embodiment. The method includes the following steps:
[0075] Step 301: Determine whether the remaining quota value of the initial node in the database is greater than or equal to the product quota requirement value.
[0076] Step 302: If yes, then the initial node is determined to have passed the second verification and meets the product credit deduction conditions. For example, if the product credit requirement is 10 units and the initial node has 11 units of remaining credit in the database, then the remaining credit in the database of the initial node is greater than the product credit requirement, which can meet the user's credit requirement and meet the product credit deduction conditions.
[0077] Step 303: If not, then it is determined that the initial node failed the second verification and cannot meet the product quota deduction conditions. For example, if the product quota requirement is 5, and the initial node has a remaining quota of 2 in the database, then the remaining quota of the initial node in the database is less than the product quota requirement, and therefore the initial node cannot meet the user's quota requirement.
[0078] In some embodiments of this specification, the actions of performing the second verification and deducting the quota on the initial node in the database are independent of the main transaction, which can reduce the database lock occupation time.
[0079] Figure 4 The diagram shown is a flowchart of an information synchronization method according to an embodiment of this paper, which specifically includes the following steps:
[0080] Step 401: After deducting the credit limit from the node to be deducted in the database, update the remaining credit limit of the node to be deducted. This step sends the data change information in the database to the asynchronous service. In some embodiments of this specification, when multiple transactions are performed simultaneously, each transaction deducts credit limit from its corresponding initial node. Therefore, the database can simultaneously perform credit limit deductions on multiple nodes to be deducted. Correspondingly, the database can simultaneously record the remaining credit limit information of multiple nodes that are currently performing credit limit deductions.
[0081] Step 402: Asynchronously synchronize the updated node information to Redis. In this step, the asynchronous service synchronously updates the change in quota data in the database to Redis using an asynchronous sending method.
[0082] In other embodiments of this specification, the database may also record and store information such as user account balance deductions and customer transaction amounts. Furthermore, once the amount has been deducted and submitted in the database, if subsequent operations encounter abnormalities, the amount can be refunded.
[0083] like Figure 5 The diagram shown is a schematic representation of a product credit limit verification device based on a cached index, according to an embodiment of this paper. The basic structure of this device is illustrated in the diagram. The functional units and modules can be implemented in software, or using general-purpose chips or specific chips to perform product credit limit verification. Specifically, the device includes:
[0084] Product quota requirement acquisition unit 501 is used to acquire product quota requirements initiated by users, wherein the product quota requirement includes product code and product quota requirement value;
[0085] The node index acquisition unit 502 is used to acquire the node index returned by Redis that meets the product quota requirements. The node index includes at least one node that meets the product quota requirements, the remaining quota of the node, and the address of the node.
[0086] The initial node determination unit 503 is used to perform a first verification on at least one node in the node index to obtain a unique initial node that matches the product quota requirement.
[0087] The judgment unit 504 is used to access the database using the initial node, and the database performs a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions.
[0088] The quota deduction unit 505 is used to determine the initial node as the node to be deducted if the product quota deduction conditions are met, and to perform quota deduction on the node to be deducted in the database.
[0089] The new unique initial node selection unit 506 is used to select other nodes besides the initial node from the node index as new unique initial nodes if the product quota deduction conditions are not met, and to cyclically determine whether the new unique initial node meets the product quota deduction conditions. If so, the quota deduction is performed on the new unique initial node in the database.
[0090] The node information update unit 507 is used to asynchronously update the node information after the quota deduction in the database to Redis, repeating the aforementioned steps.
[0091] This solution aims to improve the efficiency of product sales quota verification and deduction under complex product sales quota control rules, while ensuring data reliability and consistency. It can also effectively reduce the number of times the application accesses the database, alleviating the database access pressure. It can increase the concurrency of financial product sales, reduce the response time of each transaction, and thus increase the number of transactions processed per second by the system.
[0092] As one embodiment of this article, reference may also be made to, for example, Figure 6 The diagram shown is a schematic representation of the specific structure of the product quota verification device based on cache index in this embodiment.
[0093] As an embodiment of this article, the node index acquisition unit 502 further includes: a first node determination module 5021, used to determine a first node containing the product code from a pre-configured list of nodes with remaining quota based on the product code;
[0094] The second node determination module 5022 is used to select a node from the first node whose remaining quota value is greater than or equal to the quota requirement value, as the second node.
[0095] Figure 7 The diagram illustrates a product credit limit verification method as described in this embodiment. First, an access check is performed on the customer's product requirements. Upon passing the access check, the main process begins. Based on the user's product credit limit requirements, Redis performs a credit limit prediction and returns the node index for the credit limit. After determining the initial node from the node index, the credit limit is verified and deducted from the initial node in the database (DB). Subsequently, the credit limit change information for the initial node in the database is sent to Redis via an asynchronous task. Furthermore, the user's purchase share and monthly account information are registered and saved in the database. If any subsequent operations encounter an anomaly, the credit limit can be refunded.
[0096] like Figure 8 As shown, a computer device provided in this embodiment is described. The apparatus described in this embodiment can be the computer device in this embodiment, performing the methods described above. The computer device 802 may include one or more processors 804, such as one or more central processing units (CPUs), each of which can implement one or more hardware threads. The computer device 802 may also include any memory 806 for storing information of any kind, such as code, settings, data, etc. Without limitation, for example, the memory 806 may include any type of RAM, any type of ROM, flash memory device, hard disk, optical disk, etc. More generally, any memory can use any technology to store information. Further, any memory can provide volatile or non-volatile retention of information. Further, any memory can represent a fixed or removable component of the computer device 802. In one case, when the processor 804 executes associated instructions stored in any memory or combination of memories, the computer device 802 can perform any operation of the associated instructions. The computer device 802 also includes one or more drive mechanisms 808 for interacting with any memory, such as hard disk drive mechanisms, optical disk drive mechanisms, etc.
[0097] Computer device 802 may also include an input / output module 810 (I / O) for receiving various inputs (via input device 812) and providing various outputs (via output device 814). A specific output mechanism may include a presentation device 816 and an associated graphical user interface (GUI) 818. In other embodiments, the input / output module 810 (I / O), input device 812, and output device 814 may be omitted, and the device may function solely as a computer device within a network. Computer device 802 may also include one or more network interfaces 820 for exchanging data with other devices via one or more communication links 822. One or more communication buses 824 couple the components described above together.
[0098] Communication link 822 can be implemented in any way, such as via a local area network, a wide area network (e.g., the Internet), a point-to-point connection, or any combination thereof. Communication link 822 may include any combination of hardwired links, wireless links, routers, gateway functions, name servers, etc., governed by any protocol or combination of protocols.
[0099] Corresponding to Figures 1 to 4 In addition to the methods described above, this embodiment also provides a computer-readable storage medium storing a computer program that, when executed by a processor, performs the steps of the above-described methods.
[0100] This embodiment also provides a computer-readable instruction, wherein when a processor executes the instruction, the program therein causes the processor to perform the following: Figures 1 to 4 The method shown.
[0101] It should be understood that in the various embodiments of this document, the sequence number of each process does not imply the order of execution. The execution order of each process should be determined by its function and internal logic, and should not constitute any limitation on the implementation process of the embodiments of this document.
[0102] It should also be understood that, in the embodiments herein, the term "and / or" is merely a description of the relationship between associated objects, indicating that three relationships can exist. For example, A and / or B can represent: A existing alone, A and B existing simultaneously, and B existing alone. Additionally, the character " / " in this document generally indicates that the preceding and following associated objects have an "or" relationship.
[0103] Those skilled in the art will recognize that the units and algorithm steps of the various examples described in conjunction with the embodiments disclosed herein can be implemented in electronic hardware, computer software, or a combination of both. To clearly illustrate the interchangeability of hardware and software, the components and steps of the various examples have been generally described in terms of functionality in the foregoing description. Whether these functions are implemented in hardware or software depends on the specific application and design constraints of the technical solution. Those skilled in the art can use different methods to implement the described functions for each specific application, but such implementation should not be considered beyond the scope of this document.
[0104] Those skilled in the art will clearly understand that, for the sake of convenience and brevity, the specific working processes of the systems, devices, and units described above can be referred to the corresponding processes in the foregoing method embodiments, and will not be repeated here.
[0105] In the embodiments provided herein, it should be understood that the disclosed systems, apparatuses, and methods can be implemented in other ways. For example, the apparatus embodiments described above are merely illustrative; for instance, the division of units is only a logical functional division, and in actual implementation, there may be other division methods. For example, multiple units or components may be combined or integrated into another system, or some features may be ignored or not executed. Furthermore, the couplings or direct couplings or communication connections shown or discussed may be indirect couplings or communication connections through some interfaces, devices, or units, or they may be electrical, mechanical, or other forms of connection.
[0106] The units described as separate components may or may not be physically separate. The components shown as units may or may not be physical units; that is, they may be located in one place or distributed across multiple network units. Some or all of the units can be selected to achieve the purpose of the embodiments described herein, depending on actual needs.
[0107] Furthermore, the functional units in the various embodiments of this document can be integrated into one processing unit, or each unit can exist physically separately, or two or more units can be integrated into one unit. The integrated unit can be implemented in hardware or as a software functional unit.
[0108] If the integrated unit is implemented as a software functional unit and sold or used as an independent product, it can be stored in a computer-readable storage medium. Based on this understanding, the technical solution of this paper, in essence, or the part that contributes to the prior art, or all or part of the technical solution, can be embodied in the form of a software product. This computer software product is stored in a storage medium and includes several instructions to cause a computer device (which may be a personal computer, server, or network device, etc.) to execute all or part of the steps of the methods described in the various embodiments of this paper. The aforementioned storage medium includes various media capable of storing program code, such as USB flash drives, portable hard drives, read-only memory (ROM), random access memory (RAM), magnetic disks, or optical disks.
[0109] This document uses specific embodiments to illustrate the principles and implementation methods of this document. The descriptions of the embodiments above are only for the purpose of helping to understand the methods and core ideas of this document. At the same time, for those skilled in the art, there will be changes in the specific implementation methods and application scope based on the ideas of this document. Therefore, the content of this specification should not be construed as a limitation of this document.
Claims
1. A product quota verification method based on cache index, characterized in that, The method includes: Obtain the product credit limit request initiated by the user, wherein the product credit limit request includes the product code and the product credit limit request value; Obtain the node index returned by Redis that satisfies the product quota requirement. The node index includes at least one node that satisfies the product quota requirement, the remaining quota of the node, and the address of the node. Perform a first verification on at least one node in the node index to obtain a unique initial node that matches the product quota requirement; The database is accessed using the initial node, and the database performs a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions. If the product quota deduction conditions are met, the initial node is determined as the node to be deducted, and the quota deduction is performed on the node to be deducted in the database; If the product credit deduction condition is not met, select another node from the node index other than the initial node as the new unique initial node, and iterate to determine whether the new unique initial node meets the product credit deduction condition. If so, perform credit deduction on the new unique initial node in the database. The node information after deducting the quota from the database is asynchronously updated to Redis.
2. The product quota verification method based on cache index according to claim 1, characterized in that, The node indexes returned by Redis that satisfy the product quota requirements include: Based on the product code, determine the first node containing the product code from the pre-configured nodes with remaining quota; Select a node from the first node whose remaining quota value is greater than or equal to the quota requirement value, and use it as the second node; The node index is determined based on the product code, the address of the second node, and the remaining quota value of each second node.
3. The product quota verification method based on cache index according to claim 2, characterized in that, Based on the product code, the address of the second node, and the remaining quota value of each second node, the node index is determined as follows: The hierarchical structure of the node index is determined based on the product code and the address of the second node; Based on the product code, the address of the second node, and the remaining quota value of each second node, the node information in the structure of the index is determined.
4. The product quota verification method based on cache index according to claim 1, characterized in that, The step of performing a first verification on at least one node in the node index to obtain an initial node that matches the product quota requirement includes: Select any one of the nodes in the node index whose difference between the remaining quota and the product quota requirement exceeds a preset threshold, and use it as the initial node.
5. The product quota verification method based on cache index according to claim 4, characterized in that, The method further includes: Based on the number of historical product sales of a node, select any one of the nodes in the node index whose number of historical product sales is lower than a preset threshold, and use it as the initial node.
6. The product quota verification method based on cache index according to claim 5, characterized in that, The database is accessed using the initial node, and the database performs a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions, including: Determine whether the remaining quota value of the initial node in the database is greater than or equal to the product quota requirement value; If so, then the initial node is determined to have passed the second verification and meets the product quota deduction conditions; If not, it is determined that the initial node has failed the second verification and cannot meet the product quota deduction conditions.
7. The product quota verification method based on cache index according to claim 6, characterized in that, The method further includes: After the amount is deducted from the node to be deducted in the database, the remaining amount of the node to be deducted is updated; The updated node information is asynchronously synchronized to Redis.
8. The product quota verification method based on cache index according to claim 7, characterized in that, The method further includes: After the deduction is performed on the node to be deducted in the database, the user's account balance and the user's product transaction limit are stored in the database.
9. A product quota verification device based on cache index, characterized in that, The device includes: The product quota requirement acquisition unit is used to acquire the product quota requirement initiated by the user, wherein the product quota requirement includes the product code and the product quota requirement value. The node index acquisition unit is used to acquire the node index returned by Redis that meets the product quota requirements. The node index includes at least one node that meets the product quota requirements, the remaining quota of the node, and the address of the node. A supermarket node determination unit is used to perform a first verification on at least one node in the node index to obtain a unique initial node that matches the product quota requirement. The judgment unit is used to access the database using the initial node, and the database performs a second verification on the initial node to determine whether the initial node meets the product quota deduction conditions. The quota deduction unit is used to determine the initial node as the node to be deducted if the product quota deduction conditions are met, and to perform quota deduction on the node to be deducted in the database; The new unique initial node selection unit is used to select other nodes from the node index as new unique initial nodes if the product quota deduction conditions are not met. The unit iteratively determines whether the new unique initial node meets the product quota deduction conditions. If so, the unit performs quota deduction on the new unique initial node in the database. The node information update unit is used to asynchronously update the node information after the quota deduction in the database to Redis.
10. A computer device, comprising a memory, a processor, and a computer program stored in the memory and executable on the processor, characterized in that, When the processor executes the computer program, it implements the method according to any one of claims 1 to 8.
11. A computer-readable storage medium, characterized in that, The computer-readable storage medium stores a computer program that, when executed by a processor, implements the method according to any one of claims 1 to 8.