The realization principle of the shopping cart of Jingdong and Tmall

When JD.com
users are not logged in:
search products can be added to the shopping cart. The information of the products added to the shopping cart is saved in the cookies of the browser, and the validity period of the cookie is set, so that within the validity period, the browser cache is not cleared. , the product information added to the shopping cart after closing and restarting the browser is still there.
Advantages :
1. Does not occupy server-side storage space
2. Good user experience
3. Simple code implementation
Disadvantages :
1. The storage capacity in the cookie is limited, the maximum is 4k
2. Replacement The shopping cart information cannot be synchronized
on the device
Tmall must be logged in to use the shopping cart

Guess you like

Origin http://43.154.161.224:23101/article/api/json?id=326115698&siteId=291194637