Set MAX Item Quantity

Dan Kamins's Avatar

Dan Kamins

22 Apr, 2010 07:27 AM

Your current primitive API operations for tracked items are:

  • set-item-quantity
  • add-item-quantity
  • remove-item-quantity

I am proposing a new primitive:

  • set-item-quantity-if-more

This would be just like set-item-quantity except it would only apply if the new value were greater than the current value.

Examples of use:

  • Charge customers at end of month based on number of stocks they're tracking at any one time. Call API any time stock list size changes.
  • Charge customers at end of month based on size of largest survey they published. Call API each time a new survey response comes in.
  • etc.

As it is now, we can make several calls to load item quantity, check it locally, then call again to update.

But having an atomic primitive like this would make client logic simpler, guarantee atomicity / avoid distributed race conditions, and reduce load on your servers.

  1. Support Staff 1 Posted by Marc Guyer on 24 Apr, 2010 11:51 PM

    Marc Guyer's Avatar

    Interesting idea. I see your point, but the lookup has to occur somewhere. For the vast majority of operations, the lookup will have already taken place, whether within the same request or in the same session.

  2. Dean closed this discussion on 16 Jan, 2013 02:56 PM.

Discussions are closed to public comments.
If you need help with Cheddar please start a new discussion.

Keyboard shortcuts


? Show this help
ESC Blurs the current field

Comment Form

r Focus the comment reply box
^ + ↩ Submit the comment

You can use Command ⌘ instead of Control ^ on Mac

Recent Discussions

28 Mar, 2024 10:45 PM
24 Jan, 2024 08:33 AM
11 Jan, 2024 07:13 AM
30 Nov, 2023 02:07 AM
22 Nov, 2023 08:41 AM