def add(self, product_id, unit_cost, quantity=1, **extra_data_dict): """ Returns True if the addition of the product of the given product_id and unit_cost with given quantity is succesful else False. Can also add extra details in the form of dictionary. """ product_dict = self.__product_dict( unit_cost, quantity, extra_data_dict) self.redis_connection.hset( self.user_redis_key, product_id, Serializer.dumps(product_dict)) self.user_cart_exists = self.cart_exists(self.user_id) self.set_ttl()