# Customer Wishlist Architecture ## Specification The wishlist allows customers to save products for future purchase. Managed via `WishlistRouter.py`. --- ## Storage & Caching Strategy * **Primary DB Table**: `wishlists` (`wishlist_id`, `customer_id`, `product_id`, `created_at`). * **Cache Strategy**: Redis Set (`wishlist:{customer_id}`) containing active `product_id` strings for $O(1)$ lookup speed on product listing pages. --- ## Guest to Account Merge When an anonymous customer logs in: 1. Any wishlist items stored in local browser state are posted to `/api/v1/wishlist/merge`. 2. Duplicate `product_id` entries are ignored via SQL `INSERT IGNORE` / ON DUPLICATE KEY. 3. The Redis Set is invalidated and reloaded.