search

Home  >  Q&A  >  body text

Objective-c - Local caching of shopping cart

Let me ask you, in a shopping app, which method is used to cache the shopping cart locally, what scenarios are used, and what kind of data is cached? Thanks!

曾经蜡笔没有小新曾经蜡笔没有小新2813 days ago681

reply all(2)I'll reply

  • 巴扎黑

    巴扎黑2017-05-02 09:28:04

    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.

    reply
    0
  • 黄舟

    黄舟2017-05-02 09:28:04

    Just cache the user’s shopping information

    reply
    0
  • Cancelreply