0
我想使用Redis存储产品的数量及其ID。以下是我现在所拥有的:使用Redis导轨购物车:存储项目数量
def add
$redis.sadd current_user_cart, params[:product_id]
redirect_to carts_show_path(current_user_cart)
render json: current_user.cart_count, status: 200
end
如何在单个密钥中存储多个值?我需要使用散列吗?