Data processing method and device, equipment, storage medium and product

By refreshing the local cache using the write failure timestamp when a write fails, the problem of inconsistent cached data in distributed systems is solved, ensuring rapid updates and consistency of inventory information, and improving user experience and order processing capabilities.

CN119784473BActive Publication Date: 2025-11-07INDUSTRIAL AND COMMERCIAL BANK OF CHINA
View PDF 2 Cites 0 Cited by

Patent Information

Application Number
CN202411909796.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2024-12-24
Publication Date
2025-11-07
Estimated Expiration
2044-12-24

AI Technical Summary

Technical Problem

During business promotion activities, the local cache of the distributed application system could not be refreshed in a timely manner, resulting in inconsistencies between the cached data and the database data, which affected business operations.

Method used

The target inventory information is written to the cache database using an asynchronous processing algorithm. If the write fails, the local cache configured in the container is refreshed using the write failure timestamp to ensure that the inventory information in the container and the local cache is consistent.

Benefits of technology

It enables rapid updates and consistency of inventory information in high-concurrency scenarios, improves the user shopping experience, and supports large-scale user access and order processing.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN119784473B_ABST
    Figure CN119784473B_ABST
Patent Text Reader

Abstract

The present disclosure provides a data processing method, device, equipment, storage medium and product, which can be applied to the fields of big data and financial technology. The method comprises the following steps: in response to adding inventory to a target order, storing target inventory information in a container of a distributed system; writing the target inventory information in the container into a cache database based on an asynchronous processing algorithm to obtain a writing result; in the case that the writing result represents a writing failure, determining a writing failure timestamp; and based on the writing failure timestamp and the target inventory information, refreshing a local cache configured for the container to make the inventory information of the container and the local cache consistent, and the default mode of the local cache for obtaining the inventory information is to obtain the inventory information from the cache database.
Need to check novelty before this filing date? Find Prior Art

Description

TECHNICAL FIELD

[0001] The present disclosure relates to the field of big data and financial technology, and in particular, to a data processing method, device, equipment, storage medium and product. BACKGROUND

[0002] With the development of the Internet, a large number of products launch various business promotion activities every day, such as time-limited killing, preferential purchase, seat purchase, and the like, to promote user activity and develop new users. In the process of implementing the present disclosure, the inventors found that at least the following problem exists in the related art. When additional inventory is added to a business promotion activity, the local cache of a distributed application system cannot be refreshed in time, which easily causes the risk of inconsistency between cache data and database data, thereby causing certain impact on business development. SUMMARY

[0003] In view of the above problems, the present disclosure provides a data processing method, device, equipment, storage medium and product.

[0004] According to a first aspect of the present disclosure, a data processing method is provided, comprising: in response to additional inventory of a target order, storing target inventory information in a container of a distributed system; based on an asynchronous processing algorithm, writing the target inventory information in the container into a cache database to obtain a writing result; in a case where the writing result represents a writing failure, determining a writing failure timestamp; based on the writing failure timestamp and the target inventory information, refreshing a local cache configured for the container, so that the inventory information of the container and the local cache is consistent, and the default way for the local cache to obtain the inventory information is to obtain the inventory information from the cache database.

[0005] According to an embodiment of the present disclosure, based on the writing failure timestamp and the target inventory information, the local cache configured for the container is refreshed, so that the inventory information of the container and the local cache is consistent, comprising:

[0006] Based on the writing failure timestamp, updating an error time identifier in order metadata to obtain an update result, wherein the order metadata comprises a target order identifier and the error time identifier; in a case where the update result represents an update success, based on the target inventory information, refreshing the local cache configured for the container, so that the inventory information of the container and the local cache is consistent.

[0007] According to an embodiment of the present disclosure, the data processing method further comprises:

[0008] Before responding to the additional inventory of the target order, the storage identifier of the container without inventory is a first identifier, wherein the first identifier represents zero inventory; in a case where the local cache is successfully refreshed, the first identifier is changed to a second identifier, and the second identifier represents the existence of inventory.

[0009] According to an embodiment of the present disclosure, in response to adding inventory for a target order, target inventory information is stored in a container of a distributed system, including:

[0010] In response to adding inventory for a target order, added inventory information is obtained; target inventory information is obtained according to the number of containers and the inventory information; and the target inventory information is stored in a container of a distributed system.

[0011] According to an embodiment of the present disclosure, the target inventory information is obtained according to the number of containers and the inventory information, including:

[0012] The remaining inventory of each of the plurality of containers is determined; in a case where the remaining inventory is less than an inventory threshold, the container is determined as a target container; and the target inventory information is obtained by dividing the inventory quantity in the inventory information by the number of containers of the target container.

[0013] According to an embodiment of the present disclosure, the data processing method further includes:

[0014] In a case where the write result indicates that the writing is successful, the local cache is updated based on the inventory information in the cache database.

[0015] According to an embodiment of the present disclosure, the inventory information includes:

[0016] An order identifier, an inventory quantity, an inventory cost, and an inventory location.

[0017] A second aspect of the present disclosure provides a data processing apparatus, including: a storage module configured to store, in response to adding inventory for a target order, target inventory information in a container of a distributed system; a write result obtaining module configured to write the target inventory information in the container into a cache database based on an asynchronous processing algorithm to obtain a write result; a write failure timestamp determining module configured to, in a case where the write result indicates that the writing fails, determine a write failure timestamp; and a flushing module configured to flush a local cache configured for the container based on the write failure timestamp and the target inventory information, so that the inventory information in the container and the local cache is consistent, and a default way for the local cache to obtain inventory information is to obtain the inventory information from the cache database.

[0018] A third aspect of the present disclosure provides an electronic device, including: one or more processors; and a memory configured to store one or more computer programs, wherein the one or more processors execute the one or more computer programs to implement the steps of the method.

[0019] A fourth aspect of the present disclosure further provides a computer-readable storage medium having stored thereon a computer program or instructions, wherein the computer program or instructions are executed by a processor to implement the steps of the method.

[0020] The fifth aspect of the present disclosure also provides a computer program product comprising computer programs or instructions, which, when executed by a processor, implement the steps of the above method.

[0021] According to an embodiment of the present disclosure, by responding to the addition of target inventory, the target inventory information is stored in the container of the distributed system; the target inventory information in the container can be written into the cache database based on an asynchronous processing algorithm to obtain a write result; in the case that the write result represents a write failure, a write failure timestamp can be determined; based on the write failure timestamp and the target inventory information, the local cache configured for the container is refreshed to make the inventory information of the container and the local cache consistent, and the default way for the local cache to obtain the inventory information is to obtain the inventory information from the cache database; since the system can quickly respond to the addition of inventory request and can actively refresh the local cache based on the write failure timestamp and the target inventory information when the cache database write fails, it is not necessary to wait for the timing to refresh the local cache, which helps to improve the shopping experience of users, especially in the high-concurrency time-limited purchase scenario, the quick update and consistency of the inventory information can be ensured, and large-scale user access and order processing can be better supported. BRIEF DESCRIPTION OF DRAWINGS

[0022] The above and other objects, features and advantages of the present disclosure will become more apparent from the following description when taken in conjunction with the accompanying drawings, in which:

[0023] Figure 1 A scenario diagram of application of the data processing method according to an embodiment of the present disclosure is schematically shown;

[0024] Figure 2 A flowchart of the data processing method according to an embodiment of the present disclosure is schematically shown;

[0025] Figure 3 A flowchart of the target inventory information obtaining method according to an embodiment of the present disclosure is schematically shown;

[0026] Figure 4 A structural block diagram of the data processing apparatus according to an embodiment of the present disclosure is schematically shown;

[0027] Figure 5 A block diagram of an electronic device suitable for implementing the data processing method according to an embodiment of the present disclosure is schematically shown. DETAILED DESCRIPTION

[0028] Hereinafter, embodiments of the present disclosure will be described with reference to the accompanying drawings. It should be understood, however, that the description is merely exemplary and is not intended to limit the scope of the present disclosure. In the following detailed description of the embodiments of the present disclosure, numerous specific details are set forth in order to provide a thorough understanding of the embodiments of the present disclosure. However, it would be apparent to those skilled in the art that the embodiments of the present disclosure can be practiced without these specific details. In other instances, well-known structures and methods are not described in detail in order to avoid obscuring the concepts of the present disclosure.

[0029] The terminology used herein is for the purpose of describing particular embodiments only and is not intended to be limiting of the present disclosure. As used herein, the term "includes" and tautological expressions thereof, such as "including," means the inclusion of the stated features, steps, operations, and / or elements but not the exclusion of one or more other features, steps, operations, or elements.

[0030] All of the terms used herein (including technical and scientific terms) have the same meanings as those generally understood by those skilled in the art unless otherwise defined. It should be noted that the terms used herein should be interpreted as having meanings that are consistent with the context of the present description, and should not be interpreted in an idealized or overly formal manner.

[0031] In the case of using expressions similar to "at least one of A, B, and C, etc.", it should generally be interpreted to include any of one, or two or more of the listed items, unless otherwise specifically defined (e.g., "a system having at least one of A, B, and C" should include, but not be limited to, a system having A alone, a system having B alone, a system having C alone, a system having both A and B, a system having both A and C, a system having both B and C, and / or a system having A, B, and C together, etc.).

[0032] With the development of the Internet, a large number of products are launched for various business promotion activities every day, such as time-limited killing, preferential purchase, seat purchase, and the like, to promote user activity and develop new users. In the process of implementing the present disclosure, the inventors found that at least the following problems exist in the related art. When additional inventory is added to a business promotion activity, the local cache of a distributed application system cannot be refreshed in time, which easily causes the risk of inconsistency between cache data and database data, thereby affecting the business development.

[0033] Therefore, the present disclosure provides a data processing method, a data processing apparatus, a device, a storage medium and a product. The method comprises: in response to adding inventory to a target order, storing target inventory information in a container of a distributed system; writing the target inventory information in the container into a cache database based on an asynchronous processing algorithm to obtain a writing result; in the case that the writing result represents a writing failure, determining a writing failure timestamp; based on the writing failure timestamp and the target inventory information, refreshing a local cache configured for the container to make the inventory information of the container and the local cache consistent, and the default way for the local cache to obtain inventory information is to obtain the inventory information from the cache database.

[0034] It should be noted that the data processing method and the data processing apparatus provided by the present disclosure can be used in the field of financial technology, such as banks and other financial institutions, and can also be used in any field other than the field of financial technology, such as the field of big data. Therefore, the application field of the data processing method and the data processing apparatus provided by the present disclosure is not limited.

[0035] In the technical solutions of the present disclosure, the user information (including but not limited to user personal information, user image information, user device information such as location information, etc.) and data (including but not limited to data for analysis, stored data, displayed data, etc.) involved are information and data authorized by the user or authorized by all parties, and the collection, storage, use, processing, transmission, provision, disclosure and application of related data comply with relevant laws, regulations and standards, necessary security measures are taken, do not violate public order and good customs, and provide corresponding operation portal for user to choose authorization or refusal.

[0036] In the scenario of using personal information for automated decision-making, the method, device and system provided by the embodiments of the present disclosure all provide corresponding operation portal for the user to choose to agree or refuse the automated decision-making result; if the user chooses to refuse, the expert decision-making process is entered. The expression "automated decision-making" here refers to the activity of automatically analyzing, evaluating the behavior habits, interests and hobbies or economic, health, credit status of individuals, etc. by computer programs and making decisions. The expression "expert decision-making" here refers to the activity of making decisions by personnel who are engaged in a certain field, have special experience, knowledge and skills and reach a certain professional level.

[0037] Figure 1 The application scenario diagram of the data processing method according to the embodiments of the present disclosure is schematically shown.

[0038] As Figure 1As shown, the application scenario 100 according to this embodiment can include a scenario of recommending a bank wealth management product. The network 104 is a medium for providing a communication link between the first terminal device 101, the second terminal device 102, the third terminal device 103, and the server 105. The network 104 can include various connection types, such as wired, wireless communication links, or optical fiber cables, and the like.

[0039] The user can use the first terminal device 101, the second terminal device 102, and the third terminal device 103 to interact with the server 105 through the network 104 to receive or send messages, and the like. Various communication client applications can be installed on the first terminal device 101, the second terminal device 102, and the third terminal device 103, such as shopping applications, web browser applications, search applications, instant messaging tools, email clients, social platform software, and the like (only as examples).

[0040] The first terminal device 101, the second terminal device 102, and the third terminal device 103 can be various electronic devices with display screens and supporting web browsing, including but not limited to smartphones, tablet computers, laptop computers, desktop computers, and the like.

[0041] The server 105 can be a server providing various services, such as a background management server supporting a website browsed by the user using the first terminal device 101, the second terminal device 102, and the third terminal device 103 (only as an example). The background management server can analyze and process received user requests and the like, and feed back the processing results (such as a webpage, information, or data, or the like, obtained or generated according to the user request) to the terminal device.

[0042] It should be noted that the data processing method provided by the embodiments of the present disclosure can generally be executed by the server 105. Accordingly, the data processing apparatus provided by the embodiments of the present disclosure can generally be arranged in the server 105. The data processing method provided by the embodiments of the present disclosure can also be executed by a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105. Accordingly, the data processing apparatus provided by the embodiments of the present disclosure can also be arranged in a server or a server cluster different from the server 105 and capable of communicating with the first terminal device 101, the second terminal device 102, the third terminal device 103, and / or the server 105.

[0043] It should be understood that Figure 1 The number of terminal devices, networks, and servers in the above-mentioned embodiments is only illustrative. According to the needs of implementation, there can be any number of terminal devices, networks, and servers.

[0044] Figure 2 A flowchart of a data processing method according to an embodiment of the present disclosure is shown.

[0045] As shown in Figure 2 The data processing method of this embodiment includes operations S210-S240, which can be performed by an electronic device.

[0046] In operation S210, in response to appending inventory for a target order, target inventory information is stored in a container of a distributed system.

[0047] In operation S220, the target inventory information in the container is written into a cache database based on an asynchronous processing algorithm, and a write result is obtained.

[0048] In operation S230, in the case where the write result indicates a write failure, a write failure timestamp is determined.

[0049] In operation S240, based on the write failure timestamp and the target inventory information, a local cache configured for the container is refreshed to make the inventory information of the container and the local cache consistent.

[0050] According to an embodiment of the present disclosure, the target order can refer to a product in a time-limited purchase activity, such as an electronic product, a household appliance, or a garment, but is not limited thereto, and embodiments of the present disclosure do not limit the target order. The target inventory information can represent inventory information corresponding to the target order, such as inventory quantity, inventory number, batch number, etc., but is not limited thereto, and embodiments of the present disclosure do not limit the target inventory information. The target inventory information can be stored in a container of a distributed system in response to appending inventory for a target order.

[0051] According to an embodiment of the present disclosure, the asynchronous processing algorithm can send order information to the cache database without waiting for a response from the database, and the next order information can continue to occur. The asynchronous processing algorithm can include Kafka, message queue, etc., but is not limited thereto, and embodiments of the present disclosure do not limit this. The target inventory information in the container can be written into the cache database based on the asynchronous processing algorithm, and a write result is obtained.

[0052] According to an embodiment of the present disclosure, in the case where the write result indicates that the target inventory information fails to be written into the cache database, a write failure timestamp corresponding to the time when the cache database fails to be written can be determined. At the time corresponding to the write failure timestamp, the local cache configured for the container can be refreshed based on the target inventory information to make the inventory of the container and the local cache consistent, thereby avoiding the problem of order failure caused by the container having inventory but the local cache failing to refresh or being not timely, and ensuring the consistency and correctness of the container cache in the distributed system under the inventory appending business scenario.

[0053] According to an embodiment of the present disclosure, the background timing task reads the basic information of the time-limited purchase in the cache database in a timing manner, and updates the local cache of each container in the cluster in a timing manner if the timestamp meets the condition. Generally, the inventory of a certain product is stored in a key-value structure, and in order to avoid a large number of requests concentrated on the same server, the product inventory is divided into multiple containers to disperse the traffic to different servers, for example, 10w inventories are divided into 5 parts, each part has 2w inventories, and the corresponding data structure is container 1-2w, container 2-2w, container 3-2w, container 4-2w, and container 5-2w. The inventory information of each container is updated to the local cache by the timing task, and the database performance and user experience are improved by dividing a large number of inventory information into multiple containers to disperse the traffic.

[0054] According to an embodiment of the present disclosure, by storing the target inventory information in the container of the distributed system in response to the inventory addition of the target order, the target inventory information in the container can be written into the cache database based on an asynchronous processing algorithm to obtain a write result; in the case that the write result represents a write failure, a write failure timestamp can be determined; and the local cache configured for the container is refreshed based on the write failure timestamp and the target inventory information, so that the inventory information of the container and the local cache is consistent. The default way for the local cache to obtain the inventory information is to obtain the inventory information from the cache database. Since the system can quickly respond to the inventory addition request and can actively refresh the local cache based on the write failure timestamp and the target inventory information when the cache database write fails, it is not necessary to wait for the timing to refresh the local cache, which helps to improve the user's shopping experience, especially in the high-concurrency time-limited purchase scenario, which can ensure the quick update and consistency of the inventory information and better support large-scale user access and order processing.

[0055] According to an embodiment of the present disclosure, the local cache configured for the container is refreshed based on the write failure timestamp and the target inventory information to make the inventory information of the container and the local cache consistent, including: updating the error time identifier in the order metadata based on the write failure timestamp to obtain an update result, wherein the order metadata includes a target order identifier and an error time identifier; and in the case that the update result represents an update success, refreshing the local cache configured for the container based on the target inventory information to make the inventory information of the container and the local cache consistent.

[0056] According to an embodiment of the present disclosure, the order metadata can contain a target order identifier corresponding to the current activity and an error time identifier, and does not contain the start time, end time and inventory of the flash sale activity, because in the scenario of additional inventory, the start time and end time are not involved in the modification, and the inventory and other information are obtained and modified on the container. The target order identifier uniquely identifies the current ongoing flash sale activity, and the additional inventory is an operation of increasing the inventory of the activity. The error time identifier is a field stored in the order metadata, which is used for a background timing task to scan the flash sale activities within the time window and store them in the local cache of each container. The cached information can include the order metadata and the identifier of whether there is inventory, so that the local cache is directly obtained instead of accessing the container or database during the flash sale, thereby reducing the interface response time.

[0057] The data structure of the order metadata can be err={“proid”:”s1”,”time”:”1714”}. Wherein, err is in hashmap format, the proid field represents the activity id, which is used to uniquely identify the flash sale activity; the time field represents the write failure time stamp of the current system time, that is, the number of milliseconds since January 1, 1970, 0:00:00 Coordinated Universal Time, which is used to distinguish whether the err value has changed.

[0058] According to an embodiment of the present disclosure, the error time identifier in the order metadata can be updated based on the write failure time stamp to obtain an update result. Specifically, in the case that the cache database write result represents a write failure, the program will go to the exception handling branch to update the value of err, regardless of whether the proid is consistent with the last exception, the time will be updated to the latest time. At this time, all distributed containers will listen to the change of err, so as to actively refresh the local cache instead of waiting for the timing task to refresh. The result of refreshing the local cache is that the inventory identifier of all containers, that is, the identifier of whether there is inventory, is updated to true in each container, so that the situation of not being able to grab due to database write exception of additional inventory does not occur.

[0059] According to an embodiment of the present disclosure, in the case that the update result represents an update success, the local cache configured by the container can be refreshed based on the target inventory information, so as to make the inventory information of the container and the local cache consistent.

[0060] According to an embodiment of the present disclosure, since the distributed system has multiple containers to form a cluster, each container has its own local cache, and updating the error time identifier of the cache through unified order metadata can also avoid the situation that some containers can seize and some containers cannot seize, that is, avoid the inconsistency of cache data.

[0061] According to an embodiment of the present disclosure, the data processing method further comprises: before the inventory of the target order is added, the inventory storage identifier of the container without inventory is a first identifier, wherein the first identifier represents that the inventory is zero; and in the case that the local cache is successfully refreshed, the first identifier is changed to a second identifier, and the second identifier represents that the inventory exists.

[0062] According to an embodiment of the present disclosure, each container stores an identifier for marking whether the container has inventory, and the initial value of the identifier is true. Before the inventory of the target order is added, the inventory storage identifier of some containers is a first identifier false, and the first identifier can represent that the inventory is zero. In the case that the local cache is successfully refreshed, the first identifier is changed to a second identifier, and the second identifier can represent that the inventory exists. Specifically, after the time-limited purchase of the goods starts, the purchase request is distributed to multiple containers, and when the inventory of a container is reduced to zero, the inventory storage identifier of the container is set to false, and the next purchase request is only distributed to the containers with inventory.

[0063] According to an embodiment of the present disclosure, if the inventory information of the added inventory is stored abnormally, the local cache cannot be updated in time. Specifically, before the inventory is added, the inventory storage identifier of some containers is false. After the inventory is added, the inventory information of the database should be updated by the timing task, and the inventory storage identifier of the containers should be changed to true. However, due to the database write result representing a write failure, the inventory storage identifier of the containers is false, so that even if the inventory is added, the newly added inventory of the containers cannot be normally purchased. In addition, since multiple containers store local caches respectively, the write failure of the database on a container can cause the inconsistency of the local caches of the containers.

[0064] According to an embodiment of the present disclosure, the inventory management is more intuitive and easy by using the identifier to simplify the representation of the inventory state, and the management complexity is reduced.

[0065] According to an embodiment of the present disclosure, in response to the addition of the inventory of the target order, the target inventory information is stored in the container of the distributed system, comprising: in response to the addition of the inventory of the target order, obtaining the added inventory information; obtaining the target inventory information according to the number of containers and the inventory information; and storing the target inventory information in the container of the distributed system.

[0066] According to an embodiment of the present disclosure, the added inventory information can be obtained in response to the request of adding the inventory of the target order, and the inventory information can include the added inventory quantity. The target inventory information can be obtained according to the number of containers and the inventory quantity, and the obtained target inventory information is stored in the container of the distributed system.

[0067] According to the embodiment of the present disclosure, the target inventory information can be obtained according to the container quantity and the additional inventory information, and the target inventory information can be stored on the container, so that the market demand change can be flexibly responded, the inventory can be timely supplemented, the customer satisfaction can be improved, and the inventory cost and the operation efficiency can be optimized.

[0068] Figure 3 A flowchart of a method for obtaining target inventory information is shown schematically.

[0069] As shown in Figure 3 The method for obtaining target inventory information includes operations S310-S330, and the data processing method can be executed by an electronic device.

[0070] In operation S310, the remaining inventory quantity of each of a plurality of containers is determined.

[0071] In operation S320, the container is determined as a target container if the remaining inventory quantity is less than an inventory threshold.

[0072] In operation S330, the inventory quantity in the inventory information is divided by the container quantity of the target container to obtain the target inventory information.

[0073] According to the embodiment of the present disclosure, the remaining inventory quantity can represent the remaining inventory quantity of a target order in a time-limited purchase activity. The remaining inventory quantity of each of a plurality of containers can be determined. The container can be determined as a target container if the remaining inventory quantity is less than an inventory threshold. The inventory quantity in the inventory information can be divided by the container quantity of the target container to obtain the target inventory information. For example, there are 5 containers in total, and the remaining inventory quantities are 20, 60, 80, 5, and 15. The inventory threshold is 50. It can be known that the container with the remaining inventory quantity less than 50 can be determined as a target container, and there are 3 target containers. The inventory quantity in the inventory information is 150. The additional inventory quantity in the target container can be obtained as 50 according to the inventory quantity in the inventory information and the target container quantity.

[0074] According to the embodiment of the present disclosure, by allocating the inventory quantity to the container with a small remaining inventory quantity, the uniform distribution and load balancing of the inventory information in the container can be ensured.

[0075] According to the embodiment of the present disclosure, the data processing method further includes: in a case where the writing result indicates that the writing is successful, performing a timing update on the local cache based on the inventory information in the cache database.

[0076] According to the embodiment of the present disclosure, in a case where the writing result indicates that the target inventory information is successfully written into the cache database, the inventory information can be obtained from the cache database based on a default mode of obtaining the inventory information based on the local cache, and the local cache is updated in a timing manner.

[0077] According to an embodiment of the present disclosure, the inventory information comprises: order identifier, inventory quantity, inventory cost, inventory location.

[0078] According to an embodiment of the present disclosure, the inventory information can comprise: order identifier, inventory quantity, inventory cost, inventory location. The order identifier can represent a unique identifier of each order, which can include order number, order date, etc. The inventory quantity can represent the actual quantity of the target order in the current inventory, including in-stock quantity, pre-ordered quantity, etc. The inventory cost can represent the purchase cost or production cost of the goods, which can include raw material cost, manufacturing cost, transportation cost, etc. The inventory location can represent the specific storage location of the goods in the warehouse, which can include shelf number, area number, etc.

[0079] Figure 4 A structural block diagram of a data processing apparatus according to an embodiment of the present disclosure is schematically shown.

[0080] As shown in Figure 4 The data processing apparatus 400 of this embodiment comprises a storage module 410, a write result obtaining module 420, a write failure timestamp determining module 430, and a refreshing module 440.

[0081] The storage module 410 is configured to, in response to appending inventory of a target order, store target inventory information in a container of a distributed system.

[0082] The write result obtaining module 420 is configured to write the target inventory information in the container into a cache database based on an asynchronous processing algorithm to obtain a write result.

[0083] The write failure timestamp determining module 430 is configured to, in the case that the write result represents a write failure, determine a write failure timestamp.

[0084] The refreshing module 440 is configured to refresh a local cache configured for the container based on the write failure timestamp and the target inventory information, so as to make the inventory information of the container and the local cache consistent. The default way for the local cache to obtain the inventory information is to obtain the inventory information from the cache database.

[0085] According to an embodiment of the present disclosure, by storing target inventory information in a container of a distributed system in response to inventory addition of a target order; the target inventory information in the container can be written into a cache database based on an asynchronous processing algorithm to obtain a write result; in the case that the write result represents a write failure, a write failure timestamp can be determined; and the local cache configured for the container is refreshed based on the write failure timestamp and the target inventory information, so that the inventory information of the container and the local cache is consistent, and the default way for the local cache to obtain inventory information is to obtain the inventory information from the cache database. Since the system can quickly respond to inventory addition requests and can actively refresh the local cache based on the write failure timestamp and the target inventory information when the cache database write fails, there is no need to wait for the scheduled refresh of the local cache, which helps to improve the shopping experience of users, especially in the scenario of high concurrency and time-limited purchase, which can ensure the rapid update and consistency of inventory information and better support large-scale user access and order processing.

[0086] According to an embodiment of the present disclosure, the refresh module comprises an update result obtaining unit and a refresh unit.

[0087] The update result obtaining unit is configured to update the error time identifier in the order metadata based on the write failure timestamp to obtain an update result, wherein the order metadata comprises a target order identifier and an error time identifier.

[0088] The refresh unit is configured to refresh the local cache configured for the container based on the target inventory information in the case that the update result represents an update success, so that the inventory information of the container and the local cache is consistent.

[0089] According to an embodiment of the present disclosure, the data processing apparatus 400 of the embodiment further comprises a first identifier module and a second identifier module.

[0090] The first identifier module is configured to set the storage identifier of the container without inventory to a first identifier before responding to the inventory addition of the target order, wherein the first identifier represents that the inventory is zero.

[0091] The second identifier module is configured to change the first identifier to a second identifier in the case that the local cache is successfully refreshed, and the second identifier represents that there is inventory.

[0092] According to an embodiment of the present disclosure, the storage module comprises an obtaining unit, a target inventory information obtaining unit and a storage unit.

[0093] The obtaining unit is configured to obtain the added inventory information in response to the inventory addition of the target order.

[0094] The target inventory information obtaining unit is configured to obtain the target inventory information according to the container quantity and the inventory information.

[0095] a storage unit configured to store the target inventory information in a container of the distributed system.

[0096] According to an embodiment of the present disclosure, the target inventory information obtaining unit comprises: a remaining inventory quantity determining subunit, a target container determining subunit, and a target inventory information obtaining subunit.

[0097] The remaining inventory quantity determining subunit is configured to determine the respective remaining inventory quantities on the plurality of containers.

[0098] The target container determining subunit is configured to determine the container as the target container in a case where the remaining inventory quantity is less than the inventory threshold.

[0099] The target inventory information obtaining subunit is configured to divide the inventory quantity in the inventory information by the container quantity of the target container to obtain the target inventory information.

[0100] According to an embodiment of the present disclosure, the data processing apparatus 400 of the embodiment further comprises: a timing updating module.

[0101] The timing updating module is configured to perform timing updating on the local cache based on the inventory information in the cache database in a case where the write result indicates that the writing is successful.

[0102] According to an embodiment of the present disclosure, the inventory information comprises: an order identifier, an inventory quantity, an inventory cost, and an inventory location.

[0103] According to an embodiment of the present disclosure, any one or more of the storage module 410, the write result obtaining module 420, the write failure timestamp determining module 430, and the refreshing module 440 can be combined in one module, or any one of them can be split into multiple modules. Alternatively, at least part of the function of one or more of these modules can be combined with at least part of the function of the other modules, and implemented in one module. According to an embodiment of the present disclosure, at least one of the storage module 410, the write result obtaining module 420, the write failure timestamp determining module 430, and the refreshing module 440 can be at least partially implemented as a hardware circuit, such as a field programmable gate array (FPGA), a programmable logic array (PLA), a system on chip, a system on board, a system on package, an application specific integrated circuit (ASIC), or any other reasonable way of integrating or packaging a circuit, etc. hardware or firmware, or in any one of the three implementation ways of software, hardware and firmware or in any appropriate combination of any number of them. Alternatively, at least one of the storage module 410, the write result obtaining module 420, the write failure timestamp determining module 430, and the refreshing module 440 can be at least partially implemented as a computer program module which can perform the corresponding function when the computer program module is run.

[0104] Figure 5 A block diagram schematically illustrating an electronic device suitable for implementing a data processing method according to an embodiment of the present disclosure is shown.

[0105] As shown in Figure 5 embodiments of the present disclosure includes a processor 501 that can perform various appropriate actions and processes in accordance with a program stored in a read only memory (ROM) 502 or a program loaded into a random access memory (RAM) 503 from a storage section 508. The processor 501 can include, for example, a general purpose microprocessor (e.g., a CPU), an instruction set processor, and / or a related chipset, and / or a special purpose microprocessor (e.g., an application specific integrated circuit (ASIC)), and / or the like. The processor 501 can also include an on-board memory for cache use. The processor 501 can include a single processing unit or multiple processing units to perform the different actions of the method processes according to embodiments of the present disclosure.

[0106] In the RAM 503, various programs and data required for the operation of the electronic device 500 are stored. The processor 501, the ROM 502, and the RAM 503 are connected to each other via a bus 504. The processor 501 performs various operations of the method processes according to embodiments of the present disclosure by executing the programs in the ROM 502 and / or the RAM 503. Note that the programs can also be stored in one or more memories other than the ROM 502 and the RAM 503. The processor 501 can also perform various operations of the method processes according to embodiments of the present disclosure by executing the programs stored in the one or more memories.

[0107] According to embodiments of the present disclosure, the electronic device 500 can also include an input / output (I / O) interface 505 that is also connected to the bus 504. The electronic device 500 can also include one or more of the following components connected to the input / output (I / O) interface 505: an input section 506 including a keyboard, a mouse, etc.; an output section 507 including a display such as a cathode ray tube (CRT), a liquid crystal display (LCD), etc., and a speaker, etc.; a storage section 508 including a hard disk, etc.; and a communication section 509 including a network interface card such as a LAN card, a modem, etc. The communication section 509 performs communication processing via a network such as the Internet. A drive 510 is also connected to the input / output (I / O) interface 505 as necessary. A removable recording medium 511 such as a magnetic disk, an optical disk, a magneto-optical disk, a semiconductor memory, etc. is attached to the drive 510 as necessary, so that a computer program read out therefrom is installed in the storage section 508 as necessary.

[0108] The present disclosure also provides a computer readable storage medium, which can be included in the device / apparatus / system described in the above embodiments, or exist separately without being assembled into the device / apparatus / system. The above computer readable storage medium carries one or more programs, which, when executed, implement the method according to the embodiments of the present disclosure.

[0109] According to an embodiment of the present disclosure, the computer readable storage medium can be a non-volatile computer readable storage medium, which can include, but is not limited to, a portable computer diskette, a hard disk, a random access memory (RAM), a read-only memory (ROM), an erasable programmable read-only memory (EPROM or flash memory), a portable compact disc read-only memory (CD-ROM), an optical storage device, a magnetic storage device, or any appropriate combination thereof. In the present disclosure, the computer readable storage medium can be any tangible medium that contains or stores a program, which can be used by or in connection with an instruction execution system, apparatus, or device. For example, according to an embodiment of the present disclosure, the computer readable storage medium can include one or more memories of the ROM 502 and / or the RAM 503 described above and / or one or more memories other than the ROM 502 and the RAM 503.

[0110] Embodiments of the present disclosure also include a computer program product, which includes a computer program containing program codes for executing the methods shown in the flowcharts. When the computer program product is run in a computer system, the program codes are used to make the computer system implement the data processing method provided by the embodiments of the present disclosure.

[0111] The above functions defined in the system / apparatus of the embodiments of the present disclosure are performed when the computer program is executed by the processor 501. According to an embodiment of the present disclosure, the system, apparatus, module, unit, etc. described above can be implemented by computer program modules.

[0112] In one embodiment, the computer program can rely on a tangible storage medium such as an optical storage medium, a magnetic storage medium, etc. In another embodiment, the computer program can also be transmitted, distributed, and downloaded in the form of a signal via a network medium, and be downloaded and installed via the communication part 509 and / or installed from the detachable medium 511. The program codes contained in the computer program can be transmitted via any appropriate network medium, including but not limited to wireless, wired, etc., or any appropriate combination thereof.

[0113] In such embodiments, the computer program can be downloaded and installed from the network through the communication section 509, and / or installed from the removable media 511. When the computer program is executed by the processor 501, the above-described functions defined in the system of the embodiments of the present disclosure are executed. According to the embodiments of the present disclosure, the system, device, apparatus, module, unit, and the like described above can be implemented by the computer program modules.

[0114] According to the embodiments of the present disclosure, the program code for executing the computer program provided by the embodiments of the present disclosure can be written in any combination of one or more programming languages, and specifically, these computer programs can be implemented using high-level procedural and / or object-oriented programming language, and / or assembly / machine language. The programming language includes, but is not limited to, such as Java, C++, python, "C" language or similar programming language. The program code can be executed entirely on the user computing device, partially on the user device, partially on a remote computing device, or entirely on a remote computing device or server. In the case involving a remote computing device, the remote computing device can be connected to the user computing device through any kind of network, including a local area network (LAN) or a wide area network (WAN), or can be connected to an external computing device (for example, connected to the Internet through an Internet service provider).

[0115] The flowcharts and block diagrams in the drawings illustrate the possible implementation architecture, function and operation of the system, method and computer program product according to various embodiments of the present disclosure. In this regard, each block in the flowcharts or block diagrams can represent a module, a program segment, or a part of code, which contains one or more executable instructions for implementing the specified logical function. It should also be noted that in some alternative implementations, the functions noted in the blocks can occur in different order than that shown in the drawings. For example, two blocks that are shown in succession can actually be executed substantially in parallel, and sometimes they can be executed in reverse order, depending on the involved functions. It should also be noted that each block in the block diagrams or flowcharts, and the combination of blocks in the block diagrams or flowcharts, can be implemented by a dedicated hardware-based system that performs the specified functions or operations, or can be implemented by a combination of dedicated hardware and computer instructions.

[0116] Those skilled in the art can understand that the features described in various embodiments of the present disclosure can be combined and / or integrated in various combinations, even if such combinations or integrations are not explicitly described in the present disclosure. In particular, the features described in various embodiments of the present disclosure can be combined and / or integrated in various combinations without departing from the spirit and teachings of the present disclosure. All such combinations and / or integrations fall within the scope of the present disclosure.

[0117] The above describes embodiments of the present disclosure. However, these embodiments are merely for illustrative purposes, and are not intended to limit the scope of the present disclosure. Although each embodiment is described above separately, this does not mean that the measures in each embodiment cannot be used advantageously in combination. Those skilled in the art can make various substitutions and modifications without departing from the scope of the present disclosure, and these substitutions and modifications should all fall within the scope of the present disclosure.

Claims

1. A data processing method, characterized by, The method comprises the following steps: in response to adding inventory to a target order, storing target inventory information in a container of a distributed system; based on an asynchronous processing algorithm, writing the target inventory information in the container into a cache database to obtain a write result; in the case that the write result represents a write failure, determining a write failure timestamp; based on the write failure timestamp and the target inventory information, refreshing a local cache configured for the container to make the inventory information in the container and the local cache consistent, and the default way for the local cache to obtain inventory information is to obtain the inventory information from the cache database; the refreshing of the local cache configured for the container based on the write failure timestamp and the target inventory information to make the inventory information in the container and the local cache consistent comprises: updating an error time identifier in order metadata based on the write failure timestamp to obtain an update result, wherein the order metadata comprises a target order identifier and an error time identifier; in the case that the update result represents an update success, refreshing the local cache configured for the container based on the target inventory information to make the inventory information in the container and the local cache consistent; the step of storing the target inventory information in the container of the distributed system in response to adding inventory to the target order comprises: in response to adding inventory to the target order, obtaining the added inventory information; obtaining target inventory information according to the number of containers and the inventory information; storing the target inventory information in the container of the distributed system.

2. The method of claim 1, wherein, The method further comprises: before responding to the addition of inventory to the target order, the storage identifier of the container without inventory is a first identifier, wherein the first identifier represents zero inventory; in the case that the local cache is successfully refreshed, changing the first identifier to a second identifier, and the second identifier represents the existence of inventory.

3. The method of claim 1, wherein, The step of obtaining target inventory information according to the number of containers and the inventory information comprises: determining the respective remaining inventory of a plurality of containers; in the case that the remaining inventory is less than an inventory threshold, determining the container as a target container; dividing the inventory quantity in the inventory information by the number of target containers to obtain target inventory information.

4. The method of claim 1, wherein, The method further comprises: in the case that the write result represents a write success, performing a timed update of the local cache based on the inventory information in the cache database.

5. The method of claim 1, wherein, The inventory information comprises: order identifier, inventory quantity, inventory cost, inventory location.

6. A data processing apparatus for performing the method of any one of claims 1-5, characterized in that, The method comprises the following steps: a storage module for storing target inventory information in a container of a distributed system in response to adding inventory to a target order; a write result obtaining module for writing target inventory information in the container into a cache database based on an asynchronous processing algorithm to obtain a write result; a write failure timestamp determining module for determining a write failure timestamp in the case that the write result represents a write failure; a refreshing module for refreshing a local cache configured for the container based on the write failure timestamp and the target inventory information to make the inventory information in the container and the local cache consistent. A refreshing module is configured to refresh the local cache of the container configuration based on the write failure timestamp and the target inventory information, so as to make the container and the local cache consistent in inventory information, and the default way of the local cache to obtain the inventory information is to obtain the inventory information from the cache database. 7.An electronic device, comprising: one or more processors; a memory for storing one or more computer programs, characterized in that the one or more processors execute the one or more computer programs to implement the steps of the method according to any one of claims 1-5.

8. A computer readable storage medium having stored thereon a computer program or instructions, characterized in that, The computer program or instruction is executed by the processor to implement the steps of the method according to any one of claims 1-5.

9. A computer program product comprising computer programs or instructions, characterized in that, The computer program or instruction is executed by the processor to implement the steps of the method according to any one of claims 1-5. The computer program or instruction is executed by the processor to implement the steps of the method according to any one of claims 1-5.

Citation Information

Patent Citations

  • Distributed local cache processing method and system

    CN111988427A

  • Data caching method and device, computer equipment and storage medium

    CN119066279A