Commodity redundant data updating method and its device, equipment and medium

By storing the depended data of external online services in a redundant database on the e-commerce platform, and pushing the latest information when comparing consistency, and updating inconsistent data asynchronously, the problem of redundant data in product is solved and the consistency of product is achieved. Lightweight updates and resource savings.

CN114969067BActive Publication Date: 2024-12-24BUSINESS LINE TECHNOLOGY (SHENZHEN) CO LTD
View PDF 1 Cites 0 Cited by

Patent Information

Application Number
CN202210474005.2
Authority / Receiving Office
CN · China
Patent Type
Patents(China)
Current Assignee / Owner
Filing Date
2022-04-29
Publication Date
2024-12-24
Estimated Expiration
2042-04-29

AI Technical Summary

Technical Problem

In e-commerce platforms, it is difficult for the existing technology to effectively solve the consistency problem of redundant product data, especially when data changes or deletes, information delays and resource waste are caused.

Method used

By obtaining the dependent data of external online services, it is stored in the redundant database as the target redundant data, and pushing the latest information when comparing consistency, it is asynchronously updated inconsistent data, reducing invalid operations and thread resource consumption.

Benefits of technology

Ensure that users obtain the latest product information, reduce invalid operations, save thread resources, realize lightweight updates to redundant data, and improve data consistency and response efficiency.

✦ Generated by Eureka AI based on patent content.

Smart Images

  • Figure CN114969067B_ABST
    Figure CN114969067B_ABST
Patent Text Reader

Abstract

The present application discloses a method for updating redundant data of commodities and its device, equipment and medium, the method comprising: obtaining the dependent data of an external online service as target redundant data and storing it in a redundant database, responding to a commodity information acquisition request submitted by a terminal device, querying the target redundant data in the redundant database according to the commodity feature information and commodity information type provided in the request, and obtaining the first commodity information corresponding to the commodity information type in the data record of the matching commodity; querying and obtaining the commodity feature information and the second commodity information corresponding to the commodity information type specified in the acquisition request from the dependent data of the external online service; comparing the consistency between the first commodity information and the second commodity information, and when the comparison is consistent, pushing the first commodity information or the second commodity information to the terminal device to respond to the request. The present application can realize lightweight data synchronization and save thread resources.
Need to check novelty before this filing date? Find Prior Art

Description

Technical Field

[0001] The present application relates to the field of e-commerce network technology, and in particular to a method for updating redundant data of commodities and its corresponding device, computer equipment, and computer-readable storage medium. Background Art

[0002] Under the current popular microservice architecture system, the functions of the e-commerce platform system will be split into different subdomains for implementation. Taking a large e-commerce platform as an example, it is generally divided into a store center, a product center, a transaction center, a marketing center, a member center, a logistics center, etc. Each central system has a clear system boundary, but there must be data dependencies. For example, transaction orders depend on product prices and inventory, and marketing promotions depend on data such as membership levels and product SPU. When the dependent data changes or even deletes, the merchant expects to see the status and basic information of the corresponding data in real time. The solution to this problem is generally to query the database of the central system that provides the dependent data in real time, and call the corresponding database query interface according to the unique identification code and product information type of the required dependent data to obtain the corresponding dependent data (for example, query the corresponding product information by product ID and product title). However, according to general data processing principles, calling the database query interface in real time to query the deleted dependent data will not return data. If the dependent data cannot be queried, it means that the dependent data has been deleted, and the merchant expects to be able to see the basic information of the dependent data (such as the name of the product, etc.). At this time, it is necessary to redundant a small amount of dependent field information. There is information redundancy, and the problem that must be solved is data consistency.

[0003] The industry generally adopts two methods to solve the problem of redundant data consistency: 1. Update the data by monitoring the message queue of data changes. When the dependent data is small but the amount of changed data is large, most of the monitored messages are useless messages, wasting thread resources. 2. Query and update redundant data through scheduled tasks. The disadvantage of this solution is that the larger the amount of dependent data, the greater the delay in scheduled data updates, and when most of the data is not even updated, it also wastes thread resources.

[0004] As the two commonly used data synchronization solutions in the industry are not lightweight enough, the applicant has made corresponding explorations. Summary of the invention

[0005] The primary purpose of the present application is to solve at least one of the above problems and provide a method for updating redundant data of commodities and its corresponding device, computer equipment, and computer-readable storage medium.

[0006] In order to meet the various objectives of this application, this application adopts the following technical solutions:

[0007] A method for updating redundant commodity data provided to meet one of the purposes of this application includes the following steps:

[0008] Obtaining the dependent data of the external online service as target redundant data and storing it in the redundant database, wherein the target redundant data includes data records corresponding to a plurality of commodities, each data record includes commodity feature information of the corresponding commodity and commodity information corresponding to a partial or full commodity information type;

[0009] In response to a product information acquisition request submitted by a terminal device, query the target redundant data in the redundant database according to the product feature information and product information type provided in the request, and obtain first product information corresponding to the product information type in the data record of the matching product;

[0010] Query and obtain the commodity feature information specified in the acquisition request and second commodity information corresponding to the commodity information type from the dependent data of the external online service;

[0011] The first product information and the second product information are compared for consistency, and when the comparison is consistent, the first product information or the second product information is pushed to the terminal device to respond to the request.

[0012] In a further embodiment, the step of querying and acquiring the commodity feature information specified in the acquisition request and the second commodity information corresponding to the commodity information type from the dependent data of the external online service further includes the following steps:

[0013] Detecting whether a data record of the target redundant data has a mark indicating that its dependent data has been deleted, and when the mark does not exist, requesting the external online service to query and obtain the second product information;

[0014] When the request to query and obtain the second product information fails, marking the corresponding data record in the redundant database as having its dependent data deleted, and responding to the product information acquisition request with the first product information;

[0015] When the flag is present, the request for obtaining the product information is responded to with the first product information.

[0016] In a further embodiment, the step of comparing the consistency between the first product information and the second product information further includes the following steps:

[0017] When the first product information is inconsistent with the second product information, the second product information is pushed to the terminal device to respond to the request;

[0018] Asynchronously updating the first product information to the second product information.

[0019] In a further embodiment, the step of asynchronously updating the first product information to the second product information includes the following steps:

[0020] Create an update task for the first product information and push it to the asynchronous thread pool, and obtain a distributed lock for the update task;

[0021] When the distributed lock is acquired successfully, the first commodity information is updated to the second commodity information; otherwise, the update of the first commodity information is abandoned;

[0022] When the update is complete, the distributed lock is released.

[0023] In a further embodiment, before the step of acquiring the dependent data of the external online service and storing it in the redundant database as the target redundant data, the following steps are included:

[0024] In response to data synchronization events, the external online service is queried to obtain data records of all commodities in its commodity database as dependent data based on preset commodity feature information and partial or full commodity information types.

[0025] In a further embodiment, in response to a data synchronization event, the step of querying an external online service to obtain data records of all commodities in its commodity database as dependent data according to preset commodity feature information and partial or full commodity information types further includes the following steps:

[0026] When the data record of the product matched by the query does not exist, information indicating that the dependent data failed to be saved is output.

[0027] In a further embodiment, the dependent data includes at least two types of product information including a product title and a product default image.

[0028] A redundant data updating device for goods provided to meet one of the purposes of the present application comprises: a data acquisition module, a request response module, an information acquisition module, and a consistency comparison module, wherein the data acquisition module is used to acquire the dependent data of an external online service as target redundant data and store it in a redundant database, wherein the target redundant data comprises data records corresponding to a plurality of goods, each data record comprises the product feature information of the corresponding goods and the product information corresponding to a part or all of the product information type; the request response module is used to respond to a product information acquisition request submitted by a terminal device, query the target redundant data in the redundant database according to the product feature information and the product information type provided in the request, and obtain the first product information corresponding to the product information type in the data record of the matching goods; the information acquisition module is used to query and acquire the product feature information specified in the acquisition request and the second product information corresponding to the product information type from the dependent data of the external online service; the consistency comparison module is used to compare the consistency between the first product information and the second product information, and when the comparison is consistent, push the first product information or the second product information to the terminal device to respond to the request.

[0029] In a further embodiment, the information acquisition module includes: a mark detection submodule, used to detect whether the data record of the target redundant data has a mark indicating that its dependent data has been deleted, and when the mark does not exist, requesting the external online service to query and obtain the second product information; a request response first submodule, used to mark the corresponding data record in the redundant database as having its dependent data deleted when the request query to obtain the second product information fails, and respond to the product information acquisition request with the first product information; a request response second submodule, used to respond to the product information acquisition request with the first product information when the mark exists.

[0030] In a further embodiment, the consistency comparison module also includes: a request response third sub-module, used to push the second product information to the terminal device to respond to the request when the first product information is inconsistent with the second product information; an asynchronous update sub-module, used to asynchronously update the first product information to the second product information.

[0031] In a further embodiment, the asynchronous update submodule includes: a lock acquisition unit, which is used to create an update task for the first product information and push it to the asynchronous thread pool to acquire a distributed lock for the update task; an information update unit, which updates the first product information to the second product information when the distributed lock is successfully acquired, and otherwise abandons the update of the first product information; and a lock release unit, which is used to release the distributed lock when the update is completed.

[0032] In a further embodiment, before the data acquisition module, there is also: a data synchronization module, which is used to respond to data synchronization events, query the external online service according to preset product feature information and partial or full product information types to obtain data records of all products in its product database as dependent data.

[0033] In a further embodiment, the data synchronization module further includes: a save failure submodule, which is used to output information indicating that the dependent data has failed to be saved when the data record of the queried product that matches the data does not exist.

[0034] A computer device provided to meet one of the purposes of the present application includes a central processing unit and a memory, wherein the central processing unit is used to call and run a computer program stored in the memory to execute the steps of the commodity redundant data updating method described in the present application.

[0035] A computer-readable storage medium is provided to meet another purpose of the present application, which stores a computer program implemented according to the method for updating redundant commodity data in the form of computer-readable instructions. When the computer program is called and executed by a computer, the steps included in the method are executed.

[0036] It can be known from the typical embodiments of the present application that the technical solution of the present application has many advantages, including but not limited to the following aspects:

[0037] The present application backs up the dependent data of the external online service as target redundant data and stores it in the redundant database. When responding to the commodity information acquisition request submitted by the terminal device, the first commodity information in the data record matching the commodity feature information and commodity information type provided by the request is queried and obtained in the redundant database. Similarly, the second commodity information corresponding to the request is queried and obtained from the dependent data of the commodity database of the external service. The consistency between the first commodity information and the second commodity information is compared. When the comparison is consistent, the first commodity information is characterized as the latest information. Thus, the first commodity information or the second commodity information is pushed to the terminal device to respond to the request. It is not difficult to understand that since the dependent data is backed up and stored as target redundant data, by comparing the first and second commodity information, it can be ensured that the commodity information provided to the user is kept up to date, which also ensures the timeliness of the user obtaining the latest commodity information. Even if the dependent data is deleted in the commodity database, in theory, the first commodity information can still be used to respond to the commodity information acquisition request, and the first commodity information recorded in the corresponding backup target redundant data can be called and pushed to the terminal device to respond to the request.

[0038] It can be understood from the disclosure of this application that when the first product information is inconsistent with the second product information, it indicates that the first product information is not the latest and the first product information needs to be updated to the second product information. It can be seen that when responding to the product information acquisition request, the synchronized target redundant data is consistent with its corresponding dependent data, and there is no need to monitor to find the target redundant data that needs to be updated, which reduces invalid operations, saves thread resources, and realizes lightweight update of the target redundant data. BRIEF DESCRIPTION OF THE DRAWINGS

[0039] The above and / or additional aspects and advantages of the present application will become apparent and easily understood from the following description of the embodiments in conjunction with the accompanying drawings, in which:

[0040] Figure 1 This is a flowchart of a typical embodiment of the method for updating redundant commodity data of the present application;

[0041] Figure 2 This is a schematic diagram of the interface of some embodiments of the present application;

[0042] Figure 3 This is a flow chart of the first commodity information corresponding to the target redundant data being pushed after the dependent data is deleted in the embodiment of the present application;

[0043] Figure 4 This is a schematic diagram of the process of responding to a request and updating the first product information in an embodiment of the present application;

[0044] Figure 5 This is a schematic diagram of the process of asynchronously updating the first product information in an embodiment of the present application;

[0045] Figure 6 A schematic diagram of a process for obtaining dependent data of an external online service in an embodiment of the present application;

[0046] Figure 7 This is a principle block diagram of the commodity redundant data updating device of the present application;

[0047] Figure 8 A schematic diagram of the structure of a computer device used in this application. DETAILED DESCRIPTION

[0048] The embodiments of the present application are described in detail below, and examples of the embodiments are shown in the accompanying drawings, wherein the same or similar reference numerals throughout represent the same or similar elements or elements having the same or similar functions. The embodiments described below with reference to the accompanying drawings are exemplary and are only used to explain the present application, and cannot be interpreted as limiting the present application.

[0049] It will be understood by those skilled in the art that, unless expressly stated, the singular forms "one", "said", and "the" used herein may also include plural forms. It should be further understood that the term "comprising" used in the specification of the present application refers to the presence of the features, integers, steps, operations, elements and / or components, but does not exclude the presence or addition of one or more other features, integers, steps, operations, elements, components and / or groups thereof. It should be understood that when we refer to an element as being "connected" or "coupled" to another element, it may be directly connected or coupled to the other element, or there may be an intermediate element. In addition, the "connection" or "coupling" used herein may include wireless connection or wireless coupling. The term "and / or" used herein includes all or any unit and all combinations of one or more associated listed items.

[0050] It will be understood by those skilled in the art that, unless otherwise defined, all terms (including technical and scientific terms) used herein have the same meaning as those generally understood by those skilled in the art to which this application belongs. It should also be understood that terms such as those defined in general dictionaries should be understood to have meanings consistent with those in the context of the prior art, and will not be interpreted with idealized or overly formal meanings unless specifically defined as here.

[0051] It will be understood by those skilled in the art that the "client", "terminal" and "terminal device" used herein include both devices with wireless signal receivers, which are devices with only wireless signal receivers without transmission capabilities, and devices with receiving and transmitting hardware, which are devices with receiving and transmitting hardware capable of two-way communication on a two-way communication link. Such devices may include: cellular or other communication devices such as personal computers, tablet computers, which have single-line displays or multi-line displays or cellular or other communication devices without multi-line displays; PCS (Personal Communications Service, personal communication system), which can combine voice, data processing, fax and / or data communication capabilities; PDA (Personal Digital Assistant, personal digital assistant), which may include a radio frequency receiver, pager, Internet / intranet access, web browser, notepad, calendar and / or GPS (Global Positioning System, global positioning system) receiver; conventional laptop and / or palmtop computers or other devices, which have and / or include a conventional laptop and / or palmtop computer or other device with and / or including a radio frequency receiver. The "client", "terminal" and "terminal device" used herein may be portable, transportable, installed in a vehicle (air, sea and / or land), or suitable for and / or configured to run locally, and / or in a distributed form, at any other location on the earth and / or in space. The "client", "terminal" and "terminal device" used herein may also be a communication terminal, an Internet terminal, a music / video playing terminal, for example, a PDA, a MID (Mobile Internet Device) and / or a mobile phone with a music / video playing function, or a smart TV, a set-top box and other devices.

[0052] The hardware referred to by the names such as "server", "client", and "service node" in this application is essentially an electronic device with the equivalent capabilities of a personal computer. It is a hardware device with the necessary components revealed by the von Neumann principle, such as a central processing unit (including an arithmetic unit and a controller), a memory, an input device, and an output device. The computer program is stored in its memory, and the central processing unit calls the program stored in the external memory into the internal memory for execution, executes the instructions in the program, and interacts with the input and output devices to complete specific functions.

[0053] It should be pointed out that the concept of "server" referred to in this application can also be extended to the case of server clusters. According to the network deployment principle understood by those skilled in the art, the servers should be logically divided. In physical space, these servers can be independent of each other but can be called through interfaces, or integrated into a physical computer or a set of computer clusters. Those skilled in the art should understand this flexibility, and should not use it to restrict the implementation of the network deployment method of this application.

[0054] Unless expressly specified, one or more technical features of the present application can be deployed on a server for implementation and accessed by a client through a remote call to obtain an online service interface provided by the server, or can be directly deployed and run on a client for access.

[0055] Unless explicitly specified, the various data involved in this application can be stored remotely on a server or on a local terminal device, as long as it is suitable for being called by the technical solution of this application.

[0056] Those skilled in the art should be aware that, although the various methods of the present application are described based on the same concept and thus present commonality to each other, unless otherwise specified, these methods can be independently executed. Similarly, for each embodiment disclosed in the present application, they are all proposed based on the same inventive concept, therefore, concepts with the same expression, and concepts that are appropriately changed for convenience despite different expressions, should be understood as equivalent.

[0057] Unless the mutually exclusive relationship between the embodiments to be disclosed in this application is explicitly stated, the relevant technical features involved in each embodiment can be cross-combined to flexibly construct a new embodiment, as long as such combination does not deviate from the creative spirit of this application and can meet the needs of the prior art or solve certain deficiencies in the prior art. Those skilled in the art should be aware of this flexibility.

[0058] A method for updating redundant data of goods in the present application can be programmed as a computer program product and deployed in a client or server for execution. For example, in the e-commerce platform application scenario of the present application, it is generally deployed in a server for implementation, whereby the method can be executed by accessing an interface opened after the computer program product is running and performing human-computer interaction with the process of the computer program product through a graphical user interface.

[0059] See also Figure 1 In a typical embodiment, the commodity redundant data updating method of the present application includes the following steps:

[0060] Step S1100: Obtain the dependent data of the external online service and store it in the redundant database as target redundant data, wherein the target redundant data includes data records corresponding to multiple commodities, and each data record includes commodity feature information of the corresponding commodity and commodity information corresponding to a partial or full commodity information type;

[0061] Under the current popular microservice architecture system, the function realization of the e-commerce platform system will be split into different subdomains for realization. Taking a large e-commerce platform as an example, it is generally divided into a store center, a product center, a transaction center, a marketing center, a member center, a logistics center, etc. Each center system has a clear system boundary, but there must be data dependence, that is, there are interdependent dependent data between the online services corresponding to different center systems, and when the dependent data is changed or even deleted, the user expects to be able to see the corresponding status and product information of the dependent data in real time. For example, the current user is operating the gift center in the e-commerce platform system. The product information of the gifts included in the online service provided to the user is dependent on the external online service, that is, the dependent data. When the product information of the gift is changed, the user expects to see the corresponding status of the gift as updated and the product information as the changed product information in real time. When the product information of the gift is deleted, the user expects to see the corresponding status of the gift as deleted and the product information as part or all of the product information of the gift, such as the product title and / or product picture, etc.

[0062] It can be understood that, generally speaking, according to the basic principles of data processing, the corresponding data query interface is called to query the dependent data of the deleted external online service. Because it is deleted, the interface will not return the deleted dependent data and the query fails, but the user expects to still be able to see the product information of the deleted dependent data. For this reason, a small amount of redundant dependent data is required, that is, the product information corresponding to the partial or full product information type. Accordingly, the dependent data of the external online service is obtained as the target redundant data and stored in the redundant database, so as to prepare for the subsequent response to the acquisition request for the deleted dependent data, and push the corresponding target redundant data to the user, the dependent data includes data records corresponding to multiple products, each data record includes the product feature information of the corresponding product and the product information corresponding to the partial or full product information type, wherein the product feature information is a unique identifier established by software engineering personnel to specify each product, and the partial or full product information type can be flexibly set by technical personnel in this field according to business needs.

[0063] Step S1200, responding to a commodity information acquisition request submitted by a terminal device, querying target redundant data in the redundant database according to commodity feature information and commodity information type provided in the request, and obtaining first commodity information corresponding to the commodity information type in the data record of the matching commodity;

[0064] The server receives a product information acquisition request submitted by a terminal device and responds to it, calls a corresponding data acquisition interface to access the redundant database, queries the target redundant data that matches the product feature information and product information type provided in the request, and obtains the first product information corresponding to the product information type in the data record of the product corresponding to the product feature information. The data acquisition interface can be flexibly implemented by a person skilled in the art.

[0065] Step S1300: query and obtain the commodity feature information specified in the acquisition request and the second commodity information corresponding to the commodity information type from the dependent data of the external online service;

[0066] The corresponding external dependent data acquisition interface is called, and according to the product feature information and product information type provided in the acquisition request, the dependent data of the external online service is queried to obtain the second product information corresponding to the product information type in the data record of the product corresponding to the product feature information. The external dependent data acquisition interface can be flexibly implemented by technical personnel in this field.

[0067] Step S1400: compare the consistency between the first product information and the second product information. When the comparison is consistent, push the first product information or the second product information to the terminal device to respond to the request.

[0068] Further, the consistency between the first product information and the second product information is compared, for example, whether the character strings corresponding to the product titles in the first product information and the second product information are the same, and whether the calling storage addresses corresponding to the product images in the second product information and the second product information are the same. When the comparison is consistent, it can be understood that since the second product information obtained by querying with the same query conditions as the first product information is the result returned by the real-time query in response to the acquisition request, it represents that the first product information is the latest information of the product, and the first product information or the second product information can be pushed to the terminal device to respond to the request. In one embodiment, the first product information or the second product information is the product title and product image of a gift, the terminal device receives the first product information or the second product information, and the online service provided by the gift center system of the e-commerce platform loads the product title and product image for the terminal device to display them on their corresponding interfaces, such as Figure 2 100 shown in Figure 100.

[0069] It can be known from the typical embodiments of the present application that the technical solution of the present application has many advantages, including but not limited to the following aspects:

[0070] The present application backs up the dependent data of the external online service as target redundant data and stores it in the redundant database. When responding to the commodity information acquisition request submitted by the terminal device, the first commodity information in the data record matching the commodity feature information and commodity information type provided by the request is queried and obtained in the redundant database. Similarly, the second commodity information corresponding to the request is queried and obtained from the dependent data of the commodity database of the external service. The consistency between the first commodity information and the second commodity information is compared. When the comparison is consistent, the first commodity information is characterized as the latest information. Thus, the first commodity information or the second commodity information is pushed to the terminal device to respond to the request. It is not difficult to understand that since the dependent data is backed up and stored as target redundant data, by comparing the first and second commodity information, it can be ensured that the commodity information provided to the user is kept up to date, which also ensures the timeliness of the user obtaining the latest commodity information. Even if the dependent data is deleted in the commodity database, in theory, the first commodity information can still be used to respond to the commodity information acquisition request, and the first commodity information recorded in the corresponding backup target redundant data can be called and pushed to the terminal device to respond to the request.

[0071] It can be understood from the disclosure of this application that when the first product information is inconsistent with the second product information, it indicates that the first product information is not the latest and the first product information needs to be updated to the second product information. It can be seen that when responding to the product information acquisition request, the synchronized target redundant data is consistent with its corresponding dependent data, and there is no need to monitor to find the target redundant data that needs to be updated, which reduces invalid operations, saves thread resources, and realizes lightweight update of the target redundant data.

[0072] See also Figure 3 In a further embodiment, step S1300, the step of querying and acquiring the commodity feature information and the second commodity information corresponding to the commodity information type specified in the acquisition request from the dependent data of the external online service, further includes the following steps:

[0073] Step S1310: Detect whether the data record of the target redundant data has a mark indicating that its dependent data has been deleted. If the mark does not exist, query the external online service to obtain the second product information.

[0074] Before initiating a request to query the external online service to obtain the second product information, it is possible to first detect whether the data record of the target redundant data has a mark indicating that its dependent data has been deleted. If such a mark does not exist, it indicates that the corresponding second product information has not been deleted when the external online service was queried for acquisition last time. Based on this, the request is initiated again to call the corresponding external dependent data acquisition interface to query and obtain the second product information.

[0075] Step S1320: when the request to query and obtain the second product information fails, the corresponding data record in the redundant database is marked as having been deleted, and the request to obtain the product information is responded to with the first product information;

[0076] When the request to query and obtain the second product information fails, the dependent data of the corresponding external online service has been deleted, and accordingly, the data record of the target redundant data matching the product feature information and product information type provided in the request in the redundant database is marked as having its dependent data deleted. Further, in response to the product information acquisition request, the first product information is pushed to the terminal device.

[0077] Step S1330: When the mark exists, respond to the commodity information acquisition request with the first commodity information.

[0078] When this mark exists, it indicates that the corresponding second product information has been deleted. There is no need to initiate a query request to an external online service to obtain the second product information, and the product information acquisition request can be directly responded to with the first product information. In one embodiment, the data record of the target redundant data has a mark indicating that its dependent data has been deleted. Based on this, a "deleted" mark can be set accordingly for display on the interface to remind the user that the product information has been deleted, and the object corresponding to the product information is set to be unselectable. Furthermore, the online service provided by the gift center system of the e-commerce platform is based on the "deleted" mark and the first product information. The first product information is the product title and product image of the gift, and the product title and product image are loaded to the terminal device to display them accordingly on the interface, such as Figure 2 As shown in 101, the user can see the "deleted" status of the deleted gift and the corresponding product title and product image on the interface displayed on the terminal device.

[0079] In this embodiment, if a query to the external online service to obtain the second product information fails, the corresponding data record in the redundant database is marked as having its dependent data deleted, so that when the detection mark determines that the second product information has been deleted, there is no need to initiate a query to obtain it, thereby saving thread resources occupied by invalid requests and improving execution efficiency.

[0080] This embodiment also constructs a self-detection mechanism, which determines whether to query the external online service to obtain data by detecting whether there is a deleted mark decision for the target redundant data. When the query to the external online service to obtain the corresponding product information fails, the corresponding target redundant data is promptly marked as deleted. Therefore, there is no need to rely on external message notifications. Instead, the available status of the corresponding target redundant data is dynamically determined according to the actual situation after responding to the user's acquisition request. The amount of calculation is low, but the timeliness of maintaining redundant data is very efficient and timely.

[0081] See also Figure 4 In a further embodiment, step S1400, the step of comparing the consistency between the first product information and the second product information, further includes the following steps:

[0082] Step S1410: When the first product information and the second product information are inconsistent, the second product information is pushed to the terminal device to respond to the request;

[0083] When the first product information is inconsistent with the second product information, it can be understood that since the second product information obtained by querying with the same query conditions as the first product information is the result returned by the real-time query in response to the acquisition request, it represents that the first product information has not been updated to the latest second product information. Furthermore, in order to promptly respond to the product information acquisition request, the second product information is pushed to the terminal device to answer the request, and then the first product information is updated.

[0084] Step S1420: asynchronously update the first product information to the second product information.

[0085] A corresponding task is created for the asynchronous update of the first product information and pushed to the asynchronous thread pool, and then a distributed lock is acquired for the task. When the distributed lock is acquired successfully, the first product information is updated to the second product information. The specific implementation here is further revealed by the subsequent embodiments, and this step is not discussed for the time being.

[0086] In this embodiment, by comparing the inconsistency between the first product information and the second product information obtained by querying in response to the product information acquisition request of the terminal device, it is determined that the first product information needs to be updated to the second product information, and then the first product information is asynchronously updated accordingly to achieve lightweight update. Secondly, by querying a large amount of product information in a scheduled task manner, the product information that needs to be updated is collected and then updated, which saves thread resources and shortens the update delay. Thirdly, by comparing the message queue that monitors data changes, the product information that needs to be updated is found and then updated, which avoids invalid detection operations on product information that does not need to be updated, thereby reducing the consumption of thread resources.

[0087] See also Figure 5 In a further embodiment, step S1420, the step of asynchronously updating the first commodity information to the second commodity information, includes the following steps:

[0088] Step S1421: Create an update task for the first product information and push it to the asynchronous thread pool to obtain a distributed lock for the update task;

[0089] The update task of the first product information can be a compilable and executable code. The update task is created and pushed to the asynchronous thread pool. When the update task is executed as a thread task in the asynchronous thread pool, it first attempts to obtain a distributed lock for the thread task. The distributed lock can be implemented using the SETNX command of Redis. Of course, those skilled in the art can flexibly implement it according to actual business needs.

[0090] Step S1422: When the distributed lock is successfully acquired, the first commodity information is updated to the second commodity information; otherwise, the update of the first commodity information is abandoned;

[0091] When the distributed lock is acquired successfully, the first product information corresponding to the data record of the target redundant data matching the product information acquisition request in the redundant database is updated to the second product information, and is stored in the redundant database for subsequent calls.

[0092] When the distributed lock acquisition fails, it indicates that other thread tasks that are also updating the first product information are being started to update the first product information. Therefore, there is no need to repeat the update of the first product information, and the distributed lock acquisition is abandoned to end the current thread task.

[0093] Step S1423: When the update is completed, release the distributed lock.

[0094] When the first product information update task is completed, the corresponding thread in the asynchronous thread pool releases the obtained distributed lock.

[0095] In this embodiment, an asynchronous thread pool is used to manage threads and execute the thread task of updating the first product information, so that the creation and destruction of threads are maintained by the thread pool. A thread is not destroyed immediately after completing a task, but is reused by subsequent tasks, thereby reducing the creation and destruction of threads, saving CPU and memory system resource consumption, and reducing the time consumed by thread creation and destruction, reducing the overhead of frequent thread scheduling, and improving system throughput.

[0096] See also Figure 6In a further embodiment, before step S1100, the step of obtaining the dependent data of the external online service and storing it in the redundant database as the target redundant data, the following steps are included:

[0097] Step S1000, responding to a data synchronization event, querying an external online service according to preset commodity feature information and partial or full commodity information types to obtain data records of all commodities in its commodity database as dependent data.

[0098] In one embodiment, when a user creates and saves a product, that is, when the initialization operation is completed, a data synchronization event can be responded to to obtain product feature information preset for the product, such as a product ID. The product feature information includes product feature information corresponding to one or more products. Furthermore, partial or full product information types corresponding to the product can be preset, such as product price, product title, product name, product image, product details, etc., which can be flexibly set by technicians in this field according to redundant product fields, that is, product types required by the business. Based on this, the corresponding external dependent data acquisition interface is called to query the product database of the external online service to obtain the preset product feature information and data records of products that match the partial or full product information type. The data record includes the product information corresponding to the partial or full product information type of the product corresponding to the product feature information, and the corresponding product feature information and partial or full product information type.

[0099] In this embodiment, the dependent data of the external online service is prepared in advance so that it can be backed up as target redundant data and stored in a redundant database later, thereby achieving redundancy of the dependent data. Even if the dependent data of the external online service is deleted, the target redundant data of the corresponding redundant backup storage can be called.

[0100] In a further embodiment, step S1000, in response to a data synchronization event, querying an external online service according to preset commodity feature information and partial or full commodity information types to obtain data records of all commodities in its commodity database as dependent data, further includes the following steps:

[0101] Step S1010: When the data record of the product matched by the query does not exist, output information indicating that the dependent data has failed to be saved.

[0102] When a query is made to the product database of an external online service to obtain a data record of a matching product and no data record exists, information indicating that the dependent data has failed to be saved is output. Furthermore, a message notification prompt of an abnormality in the dependent data of the external online service can be constructed and pushed to the terminal device, so that the user can see the message notification prompt displayed for the product corresponding to the preset product feature information on the interface displayed on his terminal device. The specific content of the message notification prompt can be flexibly set by technical personnel in this field according to business needs.

[0103] See also Figure 7 , a commodity redundant data updating device provided to meet one of the purposes of the present application is a functional embodiment of the commodity redundant data updating method of the present application, the device includes: a data acquisition module 1100, a request response module 1200, an information acquisition module 1300, and a consistency comparison module 1400, wherein the data acquisition module 1100 is used to obtain the dependent data of the external online service as the target redundant data and store it in the redundant database, the target redundant data includes data records corresponding to multiple commodities, each data record includes the commodity feature information of the corresponding commodity and the commodity information corresponding to the partial or full commodity information type; the request response module 1200 is used to In response to a product information acquisition request submitted by a terminal device, the target redundant data in the redundant database is queried according to the product feature information and the product information type provided in the request, and the first product information corresponding to the product information type in the data record of the matching product is obtained; the information acquisition module 1300 is used to query and obtain the product feature information specified in the acquisition request and the second product information corresponding to the product information type from the dependent data of the external online service; the consistency comparison module 1400 is used to compare the consistency between the first product information and the second product information, and when the comparison is consistent, the first product information or the second product information is pushed to the terminal device to respond to the request.

[0104] In a further embodiment, the information acquisition module 1300 includes: a mark detection submodule, used to detect whether the data record of the target redundant data has a mark indicating that its dependent data has been deleted, and when the mark does not exist, requesting the external online service to query and obtain the second product information; a request response first submodule, used to mark the corresponding data record in the redundant database as having its dependent data deleted when the request query to obtain the second product information fails, and respond to the product information acquisition request with the first product information; a request response second submodule, used to respond to the product information acquisition request with the first product information when the mark exists.

[0105] In a further embodiment, the consistency comparison module 1400 also includes: a request response third sub-module, used to push the second product information to the terminal device to respond to the request when the first product information is inconsistent with the second product information; an asynchronous update sub-module, used to asynchronously update the first product information to the second product information.

[0106] In a further embodiment, the asynchronous update submodule includes: a lock acquisition unit, which is used to create an update task for the first product information and push it to the asynchronous thread pool to acquire a distributed lock for the update task; an information update unit, which updates the first product information to the second product information when the distributed lock is successfully acquired, and otherwise abandons the update of the first product information; and a lock release unit, which is used to release the distributed lock when the update is completed.

[0107] In a further embodiment, before the data acquisition module 1100, there is also: a data synchronization module, which is used to respond to data synchronization events, query the external online service according to preset product feature information and partial or full product information type to obtain data records of all products in its product database as dependent data.

[0108] In a further embodiment, the data synchronization module further includes: a save failure submodule, which is used to output information indicating that the dependent data has failed to be saved when the data record of the queried product that matches the data does not exist.

[0109] In order to solve the above technical problems, the present application also provides a computer device. Figure 8 As shown, a schematic diagram of the internal structure of a computer device. The computer device includes a processor, a computer-readable storage medium, a memory, and a network interface connected via a system bus. Among them, the computer-readable storage medium of the computer device stores an operating system, a database, and computer-readable instructions. The database may store a control information sequence. When the computer-readable instructions are executed by the processor, the processor may implement a method for updating redundant data of goods. The processor of the computer device is used to provide computing and control capabilities to support the operation of the entire computer device. The memory of the computer device may store computer-readable instructions. When the computer-readable instructions are executed by the processor, the processor may execute the method for updating redundant data of goods of the present application. The network interface of the computer device is used to connect and communicate with a terminal. Those skilled in the art will understand that Figure 8 The structure shown in the figure is only a block diagram of a part of the structure related to the solution of the present application, and does not constitute a limitation on the computer device to which the solution of the present application is applied. The specific computer device may include more or fewer components than those shown in the figure, or combine certain components, or have a different arrangement of components.

[0110] In this embodiment, the processor is used to execute Figure 7 The memory stores the program code and various data required to execute the above modules or submodules. The network interface is used to transmit data between user terminals or servers. The memory in this embodiment stores the program code and data required to execute all modules / submodules in the commodity redundant data updating device of this application, and the server can call the program code and data of the server to execute the functions of all submodules.

[0111] The present application also provides a storage medium storing computer-readable instructions. When the computer-readable instructions are executed by one or more processors, the one or more processors execute the steps of the method for updating redundant commodity data of any embodiment of the present application.

[0112] Those skilled in the art can understand that all or part of the processes in the above-mentioned embodiments of the present application can be implemented by instructing the relevant hardware through a computer program, and the computer program can be stored in a computer-readable storage medium. When the program is executed, it can include the processes of the embodiments of the above-mentioned methods. Among them, the aforementioned storage medium can be a computer-readable storage medium such as a disk, an optical disk, a read-only memory (ROM), or a random access memory (RAM).

[0113] Those skilled in the art will appreciate that the various operations, methods, steps, measures, and schemes in the processes discussed in this application may be alternated, altered, combined, or deleted. Further, other steps, measures, and schemes in the various operations, methods, and processes discussed in this application may also be alternated, altered, rearranged, decomposed, combined, or deleted. Further, the steps, measures, and schemes in the prior art that are similar to those disclosed in this application may also be alternated, altered, rearranged, decomposed, combined, or deleted.

[0114] The above description is only a partial implementation method of the present application. It should be pointed out that for ordinary technicians in this technical field, several improvements and modifications can be made without departing from the principles of the present application. These improvements and modifications should also be regarded as the scope of protection of the present application.

Claims

1. A method for updating redundant commodity information, characterized in that: The steps include: In response to a data synchronization event, query an external online service to obtain data records of all commodities in its commodity database as dependent data according to preset commodity feature information and partial or full commodity information types; obtain the dependent data of the external online service as target redundant data and store it in a redundant database, wherein the target redundant data includes data records corresponding to multiple commodities, each data record includes commodity feature information of the corresponding commodity and commodity information corresponding to partial or full commodity information types; In response to a product information acquisition request submitted by a terminal device, query the target redundant data in the redundant database according to the product feature information and product information type provided in the request, and obtain first product information corresponding to the product information type in the data record of the matching product; Query and obtain the commodity feature information specified in the acquisition request and the second commodity information corresponding to the commodity information type from the dependent data of the external online service, wherein, detecting whether the data record of the target redundant data has a mark indicating that its dependent data has been deleted, when the mark does not exist, requesting the external online service to query and obtain the second commodity information; when the request to query and obtain the second commodity information fails, marking the corresponding data record in the redundant database as its dependent data has been deleted, and responding to the commodity information acquisition request with the first commodity information; when the mark exists, responding to the commodity information acquisition request with the first commodity information; Compare the consistency between the first product information and the second product information. When the comparison between the first product information and the second product information is inconsistent, push the second product information to the terminal device to respond to the request, and asynchronously update the first product information to the second product information; when the comparison is consistent, push the first product information or the second product information to the terminal device to respond to the request.

2. The method for updating redundant commodity information according to claim 1, characterized in that: The step of asynchronously updating the first product information to the second product information includes the following steps: Create an update task for the first product information and push it to the asynchronous thread pool, and obtain a distributed lock for the update task; When the distributed lock is acquired successfully, the first commodity information is updated to the second commodity information; otherwise, the update of the first commodity information is abandoned; When the update is complete, the distributed lock is released.

3. The method for updating redundant commodity information according to claim 1, characterized in that: In response to the data synchronization event, the step of querying the external online service to obtain the data records of all commodities in its commodity database as the dependent data according to the preset commodity feature information and partial or full commodity information types also includes the following steps: When the data record of the product matched by the query does not exist, information indicating that the dependent data failed to be saved is output.

4. The method for updating redundant commodity information according to any one of claims 1 to 3, characterized in that: The dependent data includes at least two types of product information including a product title and a product default image.

5. A device for updating redundant commodity data, characterized in that: include: A data acquisition module is used to respond to a data synchronization event, query an external online service according to preset commodity feature information and partial or full commodity information types to obtain data records of all commodities in its commodity database as dependent data: obtain the dependent data of the external online service as target redundant data and store it in a redundant database, the target redundant data includes data records corresponding to multiple commodities, each data record includes commodity feature information of the corresponding commodity and commodity information corresponding to partial or full commodity information types; a request response module, configured to respond to a commodity information acquisition request submitted by a terminal device, query target redundant data in the redundant database according to commodity feature information and commodity information type provided in the request, and obtain first commodity information corresponding to the commodity information type in a data record of a matching commodity; an information acquisition module, configured to query and acquire the commodity feature information specified in the acquisition request and the second commodity information corresponding to the commodity information type from the dependent data of the external online service, wherein it is detected whether a data record of the target redundant data has a mark indicating that its dependent data has been deleted, and when the mark does not exist, a query is made to the external online service to acquire the second commodity information; when the query fails, the corresponding data record in the redundant database is marked as having its dependent data deleted, and the commodity information acquisition request is responded to with the first commodity information; when the mark exists, the commodity information acquisition request is responded to with the first commodity information; The consistency comparison module is used to compare the consistency between the first product information and the second product information. When the comparison is consistent, the first product information or the second product information is pushed to the terminal device to respond to the request.

6. A computer device comprising a central processing unit and a memory, characterized in that: The central processing unit is used to call and run the computer program stored in the memory to execute the steps of the method according to any one of claims 1 to 4.

7. A computer-readable storage medium, characterized in that: It stores a computer program implemented according to the method described in any one of claims 1 to 4 in the form of computer-readable instructions, and when the computer program is called and executed by a computer, the steps included in the corresponding method are executed.

Citation Information

Patent Citations

  • Commodity information updating processing method and device, equipment, medium and product

    CN114328555A