CN108665335B - Method for processing shopping cart data of shopping website - Google Patents

Method for processing shopping cart data of shopping website Download PDF

Info

Publication number
CN108665335B
CN108665335B CN201710211838.9A CN201710211838A CN108665335B CN 108665335 B CN108665335 B CN 108665335B CN 201710211838 A CN201710211838 A CN 201710211838A CN 108665335 B CN108665335 B CN 108665335B
Authority
CN
China
Prior art keywords
data
item
shopping cart
user
cache
Prior art date
Legal status (The legal status is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the status listed.)
Active
Application number
CN201710211838.9A
Other languages
Chinese (zh)
Other versions
CN108665335A (en
Inventor
廖耀华
Current Assignee (The listed assignees may be inaccurate. Google has not performed a legal analysis and makes no representation or warranty as to the accuracy of the list.)
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Original Assignee
Beijing Jingdong Century Trading Co Ltd
Beijing Jingdong Shangke Information Technology Co Ltd
Priority date (The priority date is an assumption and is not a legal conclusion. Google has not performed a legal analysis and makes no representation as to the accuracy of the date listed.)
Filing date
Publication date
Application filed by Beijing Jingdong Century Trading Co Ltd, Beijing Jingdong Shangke Information Technology Co Ltd filed Critical Beijing Jingdong Century Trading Co Ltd
Priority to CN201710211838.9A priority Critical patent/CN108665335B/en
Publication of CN108665335A publication Critical patent/CN108665335A/en
Application granted granted Critical
Publication of CN108665335B publication Critical patent/CN108665335B/en
Active legal-status Critical Current
Anticipated expiration legal-status Critical

Links

Images

Classifications

    • GPHYSICS
    • G06COMPUTING; CALCULATING OR COUNTING
    • G06QINFORMATION AND COMMUNICATION TECHNOLOGY [ICT] SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES; SYSTEMS OR METHODS SPECIALLY ADAPTED FOR ADMINISTRATIVE, COMMERCIAL, FINANCIAL, MANAGERIAL OR SUPERVISORY PURPOSES, NOT OTHERWISE PROVIDED FOR
    • G06Q30/00Commerce
    • G06Q30/06Buying, selling or leasing transactions
    • G06Q30/0601Electronic shopping [e-shopping]
    • G06Q30/0633Lists, e.g. purchase orders, compilation or processing
    • G06Q30/0635Processing of requisition or of purchase orders

Abstract

The invention provides a method, a device, electronic equipment and a storage medium for processing shopping cart data of a shopping website. The method includes receiving merchandise operation data from a user associated with a user account, the merchandise operation data including the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise, the user account being uniquely identified by a user identifier; performing a data item operation corresponding to the action on a shopping cart cache based on the commodity operation data, the shopping cart cache temporarily storing commodity data for one or more commodities placed in the shopping cart that are associated with the user account; and updating a shopping database of the shopping website based on the data item operation.

Description

Method for processing shopping cart data of shopping website
Technical Field
The present invention relates to the field of computers, and in particular, to a method, an apparatus, an electronic device, and a storage medium for processing shopping cart data of a shopping website.
Background
Shopping carts are a very important product for shopping websites, and thousands of users can operate shopping carts every day. When a large number of users operate the shopping cart at the same time, the performance of the shopping cart may be degraded, affecting the user experience.
Currently, a background processing method is generally adopted for shopping cart data of a shopping website, and mainly comprises the following steps:
(1) the shopping database is directly operated based on the user action.
(2) The shopping cart data is stored in a cache mode, and the user can inquire the commodities in the shopping cart of the user from the cache when accessing the shopping cart.
In the process of implementing the invention, the inventor finds that at least the following problems exist in the prior art.
The above method (1) of directly operating the database is that the user accesses and operates the shopping database once every time the user operates the shopping cart. Since this method requires frequent access and manipulation of the database, the performance of the shopping cart is not affected when the number of users of the shopping site is small, but is difficult to be guaranteed when the number of users is large. Moreover, a large number of users directly interact with the database, so that the response speed of the system is low. Frequent access to the database is also more demanding on network conditions and processor requirements. In addition, the method of directly operating the database must set a unique index in the database through the user and the goods, so as to prevent multiple items of the same goods added by the same user from existing in the database, and ensure the uniqueness of the items of the same goods of the same user in the database. In this way, when multiple users of the same user's shopping cart are in a highly concurrent state of operation at the same time, for example, when multiple users log in the same user account at the same time and add the same item to the shopping cart associated with the account, due to the limitation of the unique index in the database, the addition may fail, and the user experience is affected. Moreover, after the unique index is used, the uniqueness check of the data is completed by the database, and the control cannot be performed on the program.
In the method (2) for storing shopping cart data in a cache form, when a user operates (adds, deletes and modifies commodities) a shopping cart, the data in the cache of the user is emptied, and the database is updated. When a user queries a shopping cart, shopping cart data is read from the database and synchronized into the cache. Thus, the user can later retrieve data from the cache while querying the shopping cart. Compared with the method of directly operating the database, the method gives priority to the query operation of the user, and can appropriately relieve the pressure of the database. However, when the user frequently adds, deletes and modifies the goods, the database is frequently accessed and operated, so that when the user is large in quantity, the performance of the shopping cart is difficult to guarantee. Also, a large number of users interact directly with the database, making the system slow to respond. Frequent access to the database is also more demanding on network conditions and processor requirements. Meanwhile, a unique index needs to be set in the database through the user and the commodity, so that multiple items of the same commodity added by the same user are prevented from being in the database, and the uniqueness of the items of the same commodity of the same user in the database is guaranteed. Therefore, similar to method (1), in method (2), due to the limitation of unique index in the database, the addition may fail, and the user experience is affected. Moreover, after the unique index is used, the uniqueness check of the data is completed by the database, and the control cannot be performed on the program.
Disclosure of Invention
In view of the above, embodiments of the present invention provide a method, an apparatus, an electronic device, and a storage medium for processing shopping cart data of a shopping website.
To achieve the above objects, according to one aspect of the present invention, there is provided a method of processing shopping cart data of a shopping website.
The method for processing shopping cart data of a shopping website in the embodiment of the invention comprises the following steps: receiving merchandise operation data from a user associated with a user account, the merchandise operation data including the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise, the user account being uniquely identified by a user identifier; performing a data item operation corresponding to the action on a shopping cart cache based on the commodity operation data, the shopping cart cache temporarily storing commodity data for one or more commodities placed in the shopping cart that are associated with the user account; and updating a shopping database of the shopping website based on the data item operation.
Optionally, updating the shopping database based on the data item operation further comprises: adding an entry to a cache ordered queue that includes the user identifier, the data item operation, and the item data associated with the particular item; and retrieving the entry from the cache ordered queue to perform the data item operation on the item data associated with the particular item in a shopping database.
Optionally, the action is an add action, the method further comprising: determining whether the shopping cart cache includes the item data associated with the particular item; in response to determining that the shopping cart cache does not include the item data associated with the particular item, determining that a data item corresponding to the add action operates as an add operation, and performing the add operation on the shopping cart cache based on the item data associated with the particular item; and in response to determining that the shopping cart cache includes the item data associated with the particular item, determining that a data item operation corresponding to the add action is a modify operation, and performing the modify operation on the shopping cart cache based on the item data associated with the particular item.
Optionally, the action is a modify action, the method further comprising: determining that a data item operation corresponding to the modification action is a modification operation, and performing the modification operation on the shopping cart cache based on the item data associated with the particular item.
Optionally, the action is a delete action, the method further comprising: determining that a data item operation corresponding to the delete action is a delete operation, and performing the delete operation on the shopping cart cache based on the item data associated with the particular item.
Optionally, the method further comprises: receiving a query action performed on the shopping cart from the user; performing a query operation on the shopping cart cache; and returning the query result to the user.
Alternatively, the shopping cart cache may be implemented in HashSet. The item data associated with the specific item includes an identifier of the specific item, a quantity of the specific item, and a status of the specific item in the shopping cart.
To achieve the above objects, according to one aspect of the present invention, there is provided an apparatus for processing shopping cart data of a shopping website.
An apparatus for processing shopping cart data of a shopping site according to the present invention comprises: a receiving module that receives merchandise operation data from a user associated with a user account, the merchandise operation data including the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise, the user account being uniquely identified by a user identifier; an execution module that performs a data item operation corresponding to the action on a shopping cart cache that temporarily stores commodity data for one or more commodities placed in the shopping cart in association with the user account based on the commodity operation data; and the updating module is used for updating the shopping database of the shopping website based on the data item operation.
To achieve the above object, according to still another aspect of the present invention, an electronic apparatus is provided.
An electronic device of the present invention includes: one or more processors; the storage device is used for storing one or more programs, and when the one or more programs are executed by the one or more processors, the one or more processors realize the method for processing the shopping cart data of the shopping website provided by the embodiment of the invention.
To achieve the above object, according to still another aspect of the present invention, there is provided a computer-readable medium.
A computer-readable medium of the present invention has stored thereon a computer program which, when executed by a processor, implements a method of processing shopping cart data of a shopping website provided by an embodiment of the present invention.
One embodiment of the above invention has the following advantages or benefits: through with shopping cart data storage in shopping cart buffer memory, when the user moves to shopping cart execution, directly interact with shopping cart buffer memory, and can not directly interact with the database, and then make the whole data transfer of system postpone for a short time, response speed is fast, promotes system's efficiency. Moreover, when a large number of users operate shopping carts simultaneously, the shopping cart can directly interact with the shopping cart cache instead of directly interacting with the database, and requirements on network conditions and processors are reduced. In addition, by utilizing shopping cart cache, the uniqueness of database entries can be ensured without establishing a unique index in a database, and the uniqueness check of data is converted into logic which can be processed in a program and cannot be perceived by a user, so that the reliability of the system is improved, and the user experience is improved. Meanwhile, data item operation corresponding to the user action is added to the cache ordered queue, and the shopping database of the shopping website is updated in an asynchronous process based on the data item operation, so that frequent access of the user to the database is reduced, and especially when a large number of users operate shopping carts simultaneously, the requirements on network conditions and processors are reduced.
Further effects of the above-mentioned non-conventional alternatives will be described below in connection with the embodiments.
Drawings
The drawings are included to provide a better understanding of the invention and are not to be construed as unduly limiting the invention. Wherein:
FIG. 1 is a schematic diagram of a system according to an embodiment of the invention;
FIG. 2 is a flow diagram of front end processing according to an embodiment of the invention;
FIG. 3 is a schematic diagram of front end processing according to an embodiment of the invention;
FIG. 4 is a schematic diagram of a back-end asynchronous process according to an embodiment of the invention;
FIG. 5 is a schematic diagram of a device according to an embodiment of the invention;
fig. 6 is a hardware configuration diagram of an electronic device for implementing a method of processing shopping cart data of a shopping website according to an embodiment of the present invention.
Detailed Description
Exemplary embodiments of the present invention are described below with reference to the accompanying drawings, in which various details of embodiments of the invention are included to assist understanding, and which are to be considered as merely exemplary. Accordingly, those of ordinary skill in the art will recognize that various changes and modifications of the embodiments described herein can be made without departing from the scope and spirit of the invention. Also, descriptions of well-known functions and constructions are omitted in the following description for clarity and conciseness.
FIG. 1 is a schematic diagram of a system according to an embodiment of the invention. The system shown in fig. 1 comprises a client 11, a database 12 and a server 13.
The client 11 shown in fig. 1 may be a desktop computer, a mainframe computer, a tablet computer, a Personal Digital Assistant (PDA), a laptop computer, a portable gaming device, a portable media player, an e-book reader, a watch, a television platform, or another type of computing device.
The database 12 may be a shopping database. The shopping database may store user data and merchandise data. The user data includes an identifier of the user associated with the user account, e.g., a personal identification number (pin) of the user. The user account corresponds to a respective shopping cart, and the user account is uniquely identified by a user identifier. The item data includes an identifier of the item (e.g., stock unit sku of the item), the number of items (count), and the status of the item in the shopping cart (status). The state of the commodity in the shopping cart is used to indicate whether the user checks the commodity, and if the commodity is checked, the user will settle the account. For example, status in the product data is 1, indicating that the user has checked the product; status is 0, indicating that the user has not checked the item. It is common in the art to use a user identifier (e.g., a user's pin) and an identifier of an item (e.g., an item's sku) to create a unique index in a database. For example, the pin of a certain user is 1, and the sku of the product is 398723. When the user adds 1 (count 1) of the items to the shopping cart, the database stores an entry as shown in table 1 below:
user_pin sku count status
1 398723 1 1
TABLE 1
When the user adds the item again, the entries in the database are updated to the entries shown in table 2 below:
user_pin sku count status
1 398723 2 1
TABLE 2
However, without creating a unique index, if multiple users add item 398723 to the database using user 1's account at the same time, there will be multiple identical entries in the database, as shown in Table 3 below:
user_pin sku count status
1 398723 1 1
1 398723 1 1
TABLE 3
This presents a dirty data problem, resulting in the user seeing 2 records of a good in the shopping cart interface. And the correct scene should have only one record, but the number becomes 2, as shown in table 2. Unique indexes can be set in the database by the user and the goods to solve the above problems. However, the unique index causes another problem that when a plurality of users add commodities to the database by using the accounts of the users at the same time, the database is limited due to the unique index, so that the users fail to add commodities. In addition, after the unique index is used, the correctness check of the data is completed by the database, and the program cannot be controlled.
In the present invention, the above problem is solved by shopping cart caching. In one example, the shopping cart cache is implemented in a HashSet. As shown in fig. 1, HashSet is stored in the server 13, for example in the memory of the server.
HashSet temporarily stores commodity data for one or more commodities a user places in a shopping cart. HashSet is a sharded data structure of Key-field-value, sharding is performed according to Key, where Key may be a pin of a user, field may be a sku of a commodity, and value may be quantity and state data of a corresponding commodity. The commodity data of the same user account is definitely on the same segment, and the commodity data of one or more commodities put into a shopping cart by the user is stored in one segment. The keys of the HashSet are used for distinguishing different user accounts, and the commodity data of the same user account in the HashSet all have the same Key. As shown in fig. 1, for example, when commodity data of n users is stored in one HashSet, the HashSet may include n shards. The format of the data stored in HashSet is shown in table 4 below:
Figure GDA0001459587610000081
TABLE 4
As shown in fig. 1, the server 13 also stores a cache ordered queue.
The cache ordered queue temporarily stores data item operations corresponding to actions performed by a user. Each entry stored in the cache ordered queue includes a user identifier (the user's pin), a data item operation (add, delete, or modify) corresponding to an action performed by the user, and merchandise data (sku, quantity, and status in the shopping cart for the merchandise) associated with a particular merchandise. The cache queue is ordered, and each item is ensured to be added and stored in the cache ordered queue according to the sequence, so that the shopping database of the shopping website is updated subsequently according to the sequence of adding the items. There may be multiple cache ordered queues, as shown in FIG. 1, for example, there may be m cache ordered queues. Each cache ordered queue has a Key that uniquely identifies the queue. Each cache ordered queue may correspond to a plurality of different user accounts.
For example, there are 8 user accounts, and the pins of the users corresponding to each user account are 1, 2, 3, 4, 5, 6, 7, and 8, respectively. Then there are 8 hashsets and each HashSet's Key is the user's pin. If there are 3 cache ordered queues, the Key of each cache ordered queue can be obtained by the complementation of the number of user accounts and the number of cache ordered queues, i.e. 8% 3 is 3, then the keys of the cache ordered queues can be 0, 1, 2. The items of the user account with the pin of 1 are stored in the cache ordered queue with the Key of 1, the items of the user account with the pin of 2 are stored in the cache ordered queue with the Key of 2, the items of the user account with the pin of 3 are stored in the cache ordered queue with the Key of 0, the items of the user with the pin of 4 are stored in the cache ordered queue with the Key of 1, and so on.
The basic idea of the shopping cart data processing method for the shopping website based on shopping cart caching and caching ordered queues is as follows: when a user of a client performs actions on a shopping cart associated with a user account, such as when the user adds, deletes, and modifies merchandise, the actions and merchandise data of the user are transmitted to a server. The shopping cart cache in the memory of the server records commodity data of one or more commodities put into the shopping cart by the user, and the cache ordered queue records data item operation corresponding to the action of the user. The shopping database of the shopping website is then updated in an asynchronous thread based on the data item operations and the merchandise data. When the user wants to inquire the shopping cart, the user can directly inquire the corresponding shopping cart cache in the memory to obtain the commodity data of one or more commodities in the shopping cart.
The shopping cart data processing method based on shopping cart caching and caching ordered queues can be divided into two parts, namely front-end operation and back-end operation. The specific operational flow of the front-end operation and the back-end operation is shown in fig. 2 to 4.
Fig. 2 is a flow diagram of front end processing according to an embodiment of the invention.
At step 100, merchandise operations data from a user associated with a user account is received. Wherein the merchandise operation data comprises the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise. The user account may be uniquely identified by a user identifier (e.g., a pin of the user). The item data associated with a particular item includes an identifier of the particular item (e.g., sku for the item), a quantity, and a status of the item in the shopping cart. The actions performed by the user on the shopping cart associated with the user account for the particular item may include add, delete, and modify actions.
In step 200, a data item operation corresponding to the action is executed on the shopping cart cache based on the commodity operation data. A shopping cart cache temporarily stores merchandise data for one or more items placed in the shopping cart in association with the user account.
In one embodiment, the shopping cart cache may be implemented in a HashSet. The shopping cart cache may also be implemented in other data structures known to those skilled in the art that enable corresponding operations. The shopping cart cache may be dynamically created and dynamically deleted. For example, a shopping cart cache is created when a user logs into a user account. The shopping cart cache may also be created when the user performs an action on the shopping cart for the first time. And when the shopping cart cache is created, loading the shopping cart data of the user account stored in the database into the corresponding shopping cart cache. When the user logs out of the user account or closes the shopping website, the shopping cart cache can be deleted and the corresponding shopping cart cache space can be released. And when the user does not perform actions on the shopping cart within a period of time, the shopping cart cache can be automatically deleted and the corresponding shopping cart cache space can be released. The data item operations performed in the case of different user actions are described in detail below in fig. 3.
In step 300, a shopping database of the shopping website is updated based on the data item operation. Wherein updating the shopping database based on the data item operation may further comprise: adding an entry to a cache ordered queue that includes the user identifier, the data item operation, and the item data associated with the particular item; and retrieving the entry from the cache ordered queue to perform the data item operation on the item data associated with the particular item in a shopping database.
Fig. 3 is a schematic diagram of front-end processing according to an embodiment of the invention.
In one embodiment, when the action performed by the user on the shopping cart associated with the user account for a particular item is an add action, it is determined whether the shopping cart cache includes the item data associated with the particular item. When it is determined that the shopping cart cache does not include the item data associated with the item, determining that the data item operation corresponding to the add action is an add operation, and performing the add operation on the shopping cart cache based on the item data associated with the item. And store the add operation in the cache ordered queue. When it is determined that the shopping cart cache includes the item data associated with the item, determining that a data item operation corresponding to the add action is a modify operation, and performing the modify operation on the shopping cart cache based on the item data associated with the item. And storing the modified operation in the cache ordered queue
For example, when a user adds an item to a shopping cart, if the item does not exist in the shopping cart of the user, it is determined that the data item operation corresponding to the addition action of the user is an addition operation, and the addition operation is performed on the HashSet corresponding to the user account based on the item data to be added, that is, the item data is added to the HashSet corresponding to the user account. And adding an entry comprising a data item operation to the corresponding cache ordered queue, wherein the data item operation stored in the cache ordered queue is an adding operation and indicates that the user is to add the commodity to the shopping cart; if the commodity exists in the shopping cart of the user, determining that the data item operation corresponding to the adding action of the user is a modification operation, inquiring commodity data of the commodity from the HashSet corresponding to the account of the user, and performing the modification operation on the HashSet based on the commodity data to be added, namely modifying the commodity data, such as quantity, of the existing commodity. And adding an entry comprising the data item operation to the corresponding cache ordered queue, wherein the data item operation stored in the cache ordered queue is a modification operation, and the user is to modify the commodity in the shopping cart.
In one embodiment, the above operation may be performed by a cache command hSetNX in HashSet. The hSetNX command is an atomic operation, and means that if the commodity data of the commodity exists in the HashSet, the insertion fails, and false is returned, otherwise, the insertion succeeds.
Aiming at the adding action of the user, the data item operation executed on the shopping cart cache, for example, the operation command hSetNX in the HashSet, ensures the uniqueness of the database entry without establishing a unique index in the database, thereby solving the problems that the adding of commodities to the same shopping cart by a plurality of users fails due to the unique index in the methods (1) and (2) in the prior art, and the uniqueness check of the data entry is finished by the database and cannot be controlled in the program.
In one embodiment, when the action is a modify action, the method further comprises: determining that a data item operation corresponding to the modification action is a modification operation, and performing the modification operation on the shopping cart cache based on the item data associated with the particular item.
For example, when a user modifies a certain item in a shopping cart, it may be determined that the data item operation corresponding to the modification action is a modification operation, and the modification operation is performed on the HashSet based on the item data of the item. Specifically, the commodity data in the HashSet is modified through the cache command hSet. And adding an entry comprising the data item operation to the corresponding cache ordered queue, wherein the data item operation stored in the cache ordered queue is a modification operation, and the user is to modify the commodity in the shopping cart.
In one embodiment, when the action is a delete action, the method further comprises: determining that a data item operation corresponding to the delete action is a delete operation, and performing the delete operation on the shopping cart cache based on the item data associated with the particular item.
For example, when the user deletes a certain commodity in a shopping cart, it is determined that the data item operation corresponding to the deletion action is a deletion operation, and the deletion operation is performed on the HashSet based on the commodity data. Specifically, the commodity data in the HashSet is deleted through the cache command hDel. And adding an entry comprising the data item operation to the corresponding cache ordered queue, wherein the data item operation stored in the cache ordered queue is a delete operation, which indicates that the user wants to delete the commodity in the shopping cart.
In another embodiment, the method further comprises: receiving a query action executed on the shopping cart from the user, executing a query operation on the shopping cart cache, and returning a query result to the user.
For example, when a user queries a shopping cart, a query operation is performed on the HashSet, and a query result is returned to the user. Specifically, by querying the HashSet through the cache command hVals in the HashSet, the entry is the Key of the user's shopping cart, which may be constituted by the user's pin of the user's account. For example, if the user's pin is 1, then the shopping cart's Key is user _ cart _1, and the user _ cart _ prefix is added to distinguish that this Key is the user's shopping cart's Key. The result returned by the hVals query HashSet is the data of the item list in the shopping cart of user 1, and the item data of all items in the shopping cart of the user account is stored in the item list.
If the shopping cart cache does not have shopping cart data, then a query is made from the shopping database. And if the shopping cart data of the user is inquired from the shopping database, loading the data into a corresponding shopping cart cache and simultaneously transmitting the data to the user of the client.
FIG. 4 is a schematic diagram of back-end asynchronous processing according to an embodiment of the invention.
The back-end operation is primarily to update the shopping database based on a data item operation, including adding an entry to a cache ordered queue including the user identifier, the data item operation, and the merchandise data associated with the particular merchandise; and retrieving the entry from the cache ordered queue to perform the data item operation on the item data associated with the particular item in a shopping database.
The retrieval of entries from the cache ordered queue is done in asynchronous threads through asynchronous processing. The asynchronous processing process is that each cache ordered queue is processed by an asynchronous thread, and the asynchronous thread acquires data in the cache ordered queue and converts user actions into actual data item operations to be synchronized into the database. The work mechanism of the asynchronous processing may be that the cache ordered queue is empty at the beginning, the asynchronous thread sleeps, when the user adds, modifies or deletes the commodity, the data item operation corresponding to the action of the user is added as an entry and stored in the cache ordered queue, and at this time, the asynchronous thread is awakened to start processing. And after the asynchronous thread is processed, continuously acquiring entries from the buffer ordered queue, and if data is not acquired, which indicates that the user does not execute the action, the asynchronous thread sleeps again until the asynchronous thread is awakened next time. The work mechanism of asynchronous processing may also be to wake up an asynchronous thread to start processing at a certain frequency or when the system is idle.
The specific operation process of the back-end operation is as follows: the asynchronous thread obtains an entry from the cache ordered queue, then analyzes corresponding user data, commodity data and data item operation from the entry, and then executes corresponding data item operation on the corresponding commodity data in the shopping database according to the sequence. For example, if the data item operation parsed from the acquired entry is an add operation, adding user data (pin of the user) and the article data (sku of the article, the number of articles, and the state of the article in the shopping cart) to the database; if the data item operation analyzed from the acquired items is a deleting operation, deleting corresponding commodity data from the database according to the pin of the user and the sku of the commodity; and if the data item operation analyzed from the acquired item is a modification operation, modifying the item of commodity data in the database according to the pin of the user and the sku of the commodity, for example, modifying the quantity or the state of the commodity.
Fig. 5 is a schematic structural diagram of an apparatus according to an embodiment of the present invention.
The apparatus 50 in fig. 5 comprises a receiving module 51, an executing module 52 and an updating module 53.
Wherein the receiving module 51 may receive merchandise operation data from a user associated with a user account, the merchandise operation data including the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise, the user account being uniquely identified by a user identifier. The user account may be uniquely identified by a user identifier, e.g., a pin of the user. The item data associated with a particular item includes an identifier of the particular item (e.g., sku for the item), a quantity, and a status of the item in the shopping cart. The actions performed by the user on the shopping cart associated with the user account for the particular item may include add, delete, and modify actions. The receiving module 51 may also receive a query action from the user to perform on the shopping cart.
The execution module 52 executes a data item operation corresponding to the action on the shopping cart cache based on the commodity operation data. A shopping cart cache temporarily stores merchandise data for one or more items placed in the shopping cart in association with the user account. Shopping cart caching may be implemented in HashSet.
The updating module 53 updates the shopping database of the shopping website based on the data item operation. Wherein updating the shopping database based on the data item operation may further comprise: adding an entry to a cache ordered queue that includes the user identifier, the data item operation, and the item data associated with the particular item; and retrieving the entry from the cache ordered queue to perform the data item operation on the item data associated with the particular item in a shopping database.
The invention also provides an electronic device and a readable storage medium according to the embodiment of the invention.
The electronic device of the present invention includes: at least one processor; and a memory communicatively coupled to the at least one processor; wherein the memory stores instructions executable by the at least one processor to cause the at least one processor to perform the method of processing shopping cart data for a shopping website provided by the present invention.
The non-transitory computer readable storage medium of the present invention stores computer instructions for causing the computer to perform the method of processing shopping cart data for a shopping website provided by the present invention.
Fig. 6 is a schematic diagram of a hardware structure of an electronic device according to an embodiment of the present invention. As shown in fig. 6, the electronic apparatus includes: one or more processors 61 and a memory 62, with one processor 61 being an example in fig. 6. The memory 62 is a non-transitory computer readable storage medium provided by the present invention.
The electronic device of the method of processing shopping cart data of a shopping website may further include: an input device 63 and an output device 64.
The processor 61, the memory 62, the input device 63 and the output device 64 may be connected by a bus or other means, as exemplified by the bus connection in fig. 6.
The memory 62, as a non-transitory computer readable storage medium, can be used to store non-transitory software programs, non-transitory computer executable programs, and modules, such as program instructions/modules (e.g., the receiving module 51, the executing module 52, and the updating module 53 shown in fig. 5) corresponding to the method for processing shopping cart data of a shopping website in the embodiment of the present invention. The processor 61 executes various functional applications of the server and data processing by running the non-transitory software programs, instructions and modules stored in the memory 62, namely, implements the method of processing shopping cart data of a shopping website in the above-described method embodiment.
The memory 62 may include a storage program area and a storage data area, wherein the storage program area may store an operating system, an application program required for at least one function; the storage data area may store data created from use of a device that processes shopping cart data of a shopping website, and the like. Further, the memory 62 may include high speed random access memory, and may also include non-transitory memory, such as at least one magnetic disk storage device, flash memory device, or other non-transitory solid state storage device. In some embodiments, the memory 62 optionally includes memory located remotely from the processor 61, which may be connected via a network to a device that processes shopping cart data for a shopping website. Examples of such networks include, but are not limited to, the internet, intranets, local area networks, mobile communication networks, and combinations thereof.
The input device 63 may receive input numeric or character information and generate key signal inputs related to user settings and function control of the device for processing shopping cart data of a shopping site. The output device 64 may include a display device such as a display screen.
The one or more modules are stored in the memory 62 and, when executed by the one or more processors 61, perform a method of processing shopping cart data for a shopping website in any of the method embodiments described above.
The product can execute the method provided by the embodiment of the invention, and has corresponding functional modules and beneficial effects of the execution method. For technical details that are not described in detail in this embodiment, reference may be made to the method provided by the embodiment of the present invention.
According to the technical scheme of the embodiment of the invention, the shopping cart data is stored in the shopping cart cache, and when a user executes an action on the shopping cart, the user directly interacts with the shopping cart cache instead of directly interacting with the database, so that the whole data transmission delay of the system is small, the response speed is high, and the efficiency of the system is improved. Moreover, when a large number of users operate shopping carts simultaneously, the shopping cart can directly interact with the shopping cart cache instead of directly interacting with the database, and requirements on network conditions and processors are reduced. In addition, by utilizing shopping cart cache, the uniqueness of database entries can be ensured without establishing a unique index in a database, and the uniqueness check of data is converted into logic which can be processed in a program and cannot be perceived by a user, so that the reliability of the system is improved, and the user experience is improved. Meanwhile, data item operation corresponding to the user action is added to the cache ordered queue, the database of the shopping website is updated in the asynchronous process based on the data item operation, frequent access of the user to the database is reduced, and especially when a large number of users operate shopping carts simultaneously, requirements on network conditions and processors are reduced.
The above-described embodiments should not be construed as limiting the scope of the invention. Those skilled in the art will appreciate that various modifications, combinations, sub-combinations, and substitutions can occur, depending on design requirements and other factors. Any modification, equivalent replacement, and improvement made within the spirit and principle of the present invention should be included in the protection scope of the present invention.

Claims (9)

1. A method of processing shopping cart data for a shopping website, comprising:
receiving merchandise operation data from a user associated with a user account, the merchandise operation data including the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise, the user account being uniquely identified by a user identifier;
performing a data item operation corresponding to the action on a shopping cart cache based on the commodity operation data, the shopping cart cache temporarily storing commodity data for one or more commodities placed in the shopping cart that are associated with the user account; and
updating a shopping database of the shopping website based on the data item operation;
wherein updating the shopping database based on the data item operation comprises:
adding an entry to a cache ordered queue that includes the user identifier, the data item operation, and the item data associated with the particular item; and
obtaining the entry from the cache ordered queue to perform the data item operation on the item data associated with the particular item in a shopping database.
2. The method of claim 1, wherein the action is an add action, the method further comprising:
determining whether the shopping cart cache includes the item data associated with the particular item;
in response to determining that the shopping cart cache does not include the item data associated with the particular item, determining that a data item corresponding to the add action operates as an add operation, and performing the add operation on the shopping cart cache based on the item data associated with the particular item; and
in response to determining that the shopping cart cache includes the item data associated with the particular item, determining that a data item operation corresponding to the add action is a modify operation, and performing the modify operation on the shopping cart cache based on the item data associated with the particular item.
3. The method of claim 1, wherein the action is a modify action, the method further comprising:
determining that a data item operation corresponding to the modification action is a modification operation, and performing the modification operation on the shopping cart cache based on the item data associated with the particular item.
4. The method of claim 1, wherein the action is a delete action, the method further comprising:
determining that a data item operation corresponding to the delete action is a delete operation, and performing the delete operation on the shopping cart cache based on the item data associated with the particular item.
5. The method of claim 1, further comprising:
receiving a query action performed on the shopping cart from the user;
performing a query operation on the shopping cart cache; and
and returning the query result to the user.
6. The method of any of claims 1-5, wherein the shopping cart cache is implemented in a HashSet, and wherein the merchandise data associated with the particular merchandise includes an identifier of the particular merchandise, a quantity of the particular merchandise, and a status of the particular merchandise in the shopping cart.
7. An apparatus for processing shopping cart data for a shopping website, comprising:
a receiving module that receives merchandise operation data from a user associated with a user account, the merchandise operation data including the user account, merchandise data associated with a particular merchandise, and an action performed by the user on a shopping cart associated with the user account for the particular merchandise, the user account being uniquely identified by a user identifier;
an execution module that performs a data item operation corresponding to the action on a shopping cart cache that temporarily stores commodity data for one or more commodities placed in the shopping cart in association with the user account based on the commodity operation data; and
an update module that operates to update a shopping database of the shopping website based on the data item;
wherein updating the shopping database based on the data item operation comprises:
adding an entry to a cache ordered queue that includes the user identifier, the data item operation, and the item data associated with the particular item; and
obtaining the entry from the cache ordered queue to perform the data item operation on the item data associated with the particular item in a shopping database.
8. An electronic device, comprising:
one or more processors;
a storage device for storing one or more programs,
when executed by the one or more processors, cause the one or more processors to implement the method of any one of claims 1-6.
9. A computer-readable medium, on which a computer program is stored, which, when being executed by a processor, carries out the method according to any one of claims 1-6.
CN201710211838.9A 2017-04-01 2017-04-01 Method for processing shopping cart data of shopping website Active CN108665335B (en)

Priority Applications (1)

Application Number Priority Date Filing Date Title
CN201710211838.9A CN108665335B (en) 2017-04-01 2017-04-01 Method for processing shopping cart data of shopping website

Applications Claiming Priority (1)

Application Number Priority Date Filing Date Title
CN201710211838.9A CN108665335B (en) 2017-04-01 2017-04-01 Method for processing shopping cart data of shopping website

Publications (2)

Publication Number Publication Date
CN108665335A CN108665335A (en) 2018-10-16
CN108665335B true CN108665335B (en) 2021-09-14

Family

ID=63784137

Family Applications (1)

Application Number Title Priority Date Filing Date
CN201710211838.9A Active CN108665335B (en) 2017-04-01 2017-04-01 Method for processing shopping cart data of shopping website

Country Status (1)

Country Link
CN (1) CN108665335B (en)

Families Citing this family (5)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN112202876B (en) * 2020-09-28 2022-05-03 北京金山云网络技术有限公司 Request processing method and device and electronic equipment
CN112584186B (en) * 2020-11-30 2023-02-21 微梦创科网络科技(中国)有限公司 Live broadcast method and system based on establishment of E-commerce live broadcast shopping cart service
CN112561654A (en) * 2020-12-21 2021-03-26 杭州贝嘟科技有限公司 Commodity adding method and device, computer equipment and readable storage medium
CN112988812B (en) * 2021-03-10 2024-02-06 京东科技控股股份有限公司 Inventory data processing method, device, equipment and storage medium
CN113610604A (en) * 2021-08-09 2021-11-05 上海微盟企业发展有限公司 Data processing method, device, equipment and storage medium

Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102118890A (en) * 2009-12-31 2011-07-06 上海巨服信息科技有限公司 Transmission processing method for mobile phone and database
CN103903152A (en) * 2014-03-27 2014-07-02 沈阳化工大学 Online shopping center system
CN104376472A (en) * 2013-08-15 2015-02-25 林宛姿 Cross-website shopping server and cross-website online shopping realization method
CN104572919A (en) * 2014-12-26 2015-04-29 北京奇虎科技有限公司 Service information processing method and browser client
CN105282221A (en) * 2014-07-16 2016-01-27 索尼公司 Mesh network applied to fixed establishment with movable items therein
CN105488078A (en) * 2014-10-10 2016-04-13 阿里巴巴集团控股有限公司 Web page data caching method and equipment
CN105808767A (en) * 2016-03-21 2016-07-27 北京小米移动软件有限公司 Data updating method and apparatus
CN105930544A (en) * 2016-06-28 2016-09-07 武汉合创源科技有限公司 Method and system for loading webpages for shopping
CN106372889A (en) * 2016-08-31 2017-02-01 石家庄学院 Smart shopping cart based on RFID, shopping system based on RFID and application method thereof

Family Cites Families (7)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
US7848964B2 (en) * 2008-07-14 2010-12-07 Sunrise R&D Holdings, Llc Method for shopping in a store
US8244700B2 (en) * 2010-02-12 2012-08-14 Microsoft Corporation Rapid update of index metadata
CN101968815B (en) * 2010-10-29 2012-07-25 西本新干线电子商务有限公司 Processing method of concurrent requests
US20130211951A1 (en) * 2012-02-09 2013-08-15 Wal-Mart Stores, Inc. Self learning gift recommendation engine
US9069835B2 (en) * 2012-05-21 2015-06-30 Google Inc. Organizing data in a distributed storage system
CN104778273B (en) * 2015-04-24 2018-10-09 淘金信息科技江苏有限公司 A kind of big data analysis system for shopping website
CN106156309A (en) * 2016-07-01 2016-11-23 五八同城信息技术有限公司 Method for reading data and device

Patent Citations (9)

* Cited by examiner, † Cited by third party
Publication number Priority date Publication date Assignee Title
CN102118890A (en) * 2009-12-31 2011-07-06 上海巨服信息科技有限公司 Transmission processing method for mobile phone and database
CN104376472A (en) * 2013-08-15 2015-02-25 林宛姿 Cross-website shopping server and cross-website online shopping realization method
CN103903152A (en) * 2014-03-27 2014-07-02 沈阳化工大学 Online shopping center system
CN105282221A (en) * 2014-07-16 2016-01-27 索尼公司 Mesh network applied to fixed establishment with movable items therein
CN105488078A (en) * 2014-10-10 2016-04-13 阿里巴巴集团控股有限公司 Web page data caching method and equipment
CN104572919A (en) * 2014-12-26 2015-04-29 北京奇虎科技有限公司 Service information processing method and browser client
CN105808767A (en) * 2016-03-21 2016-07-27 北京小米移动软件有限公司 Data updating method and apparatus
CN105930544A (en) * 2016-06-28 2016-09-07 武汉合创源科技有限公司 Method and system for loading webpages for shopping
CN106372889A (en) * 2016-08-31 2017-02-01 石家庄学院 Smart shopping cart based on RFID, shopping system based on RFID and application method thereof

Also Published As

Publication number Publication date
CN108665335A (en) 2018-10-16

Similar Documents

Publication Publication Date Title
CN108665335B (en) Method for processing shopping cart data of shopping website
US10664497B2 (en) Hybrid database table stored as both row and column store
US10346383B2 (en) Hybrid database table stored as both row and column store
US8768927B2 (en) Hybrid database table stored as both row and column store
JP6152226B2 (en) Generating a cache query request
US20160171039A1 (en) Generating hash values
US9817879B2 (en) Asynchronous data replication using an external buffer table
US9507821B2 (en) Mail indexing and searching using hierarchical caches
CN112269789B (en) Method and device for storing data, and method and device for reading data
US11119742B2 (en) Cache efficient reading of result values in a column store database
CN111046034A (en) Method and system for managing memory data and maintaining data in memory
EP2874077A2 (en) Stateless database cache
CN110704194A (en) Method and system for managing memory data and maintaining data in memory
CN114116613A (en) Metadata query method, equipment and storage medium based on distributed file system
US10747773B2 (en) Database management system, computer, and database management method
CN107943846B (en) Data processing method and device and electronic equipment
CN112416991A (en) Data processing method and device and storage medium
JP2015197909A (en) Online analytical processing method using 2 level query by sql parsing and result cashing for processing large capacity data
US11327962B1 (en) Real-time analytical database system for querying data of transactional systems
CN111290714A (en) Data reading method and device
US11157506B2 (en) Multiform persistence abstraction
US11151178B2 (en) Self-adapting resource aware phrase indexes
EP3293643B1 (en) Paging mechanism for in-memory data management system
US11556540B1 (en) Transmission format cache for database reads
KR101755276B1 (en) SYSTEM AND METHOD MANAGING TRANSACTION BASED ON NoSQL

Legal Events

Date Code Title Description
PB01 Publication
PB01 Publication
SE01 Entry into force of request for substantive examination
SE01 Entry into force of request for substantive examination
GR01 Patent grant
GR01 Patent grant