objective-c - 关于购物车的本地缓存
曾经蜡笔没有小新
曾经蜡笔没有小新 2017-05-02 09:26:04
0
2
621

问一下大家,一个购物app,购物车本地缓存是用哪种方式,那些场景,大概缓存那些数据?谢谢!

曾经蜡笔没有小新
曾经蜡笔没有小新

reply all(2)
巴扎黑

Not logged in: save the cookie when adding to the shopping cart, and the shopping cart displays the cookie content
After logging in: when logging in, take the cookie and save it to the database shopping cart table, handle the duplication of cookies and tables, clear the cookies, and the shopping cart displays the contents of the table. Save it directly to the table when adding to the shopping cart

As for the stored data, it depends on the design of the product. The necessary ones include: product id, purchase quantity, and product attributes selected by the user (if any). If the product is deleted and only a field is changed, these data should meet the needs. There are more user IDs in the table than cookies
Another note: If the record is really deleted when the product is deleted, you can consider storing multiple product names, product pictures, etc.

黄舟

Just cache the user’s shopping information

Latest Downloads
More>
Web Effects
Website Source Code
Website Materials
Front End Template
About us Disclaimer Sitemap
php.cn:Public welfare online PHP training,Help PHP learners grow quickly!