[erlang-questions] Enhancing the ETS API

Jay Nelson jay@REDACTED
Thu Jul 18 09:25:59 CEST 2013


If increment does not violate threshold, it operates as currently, returning
the newly incremented value. But rather than warping the value if the
threshold is violated, just leave it as is and return the current value.

I wanted to increment a pointer, but not beyond a certain value, so that
it always pointed to the top of the stack. This feature was most useful
when the threshold was stored in a different field of the same record
and I did not know what that value was.

On Jul 18, 2013, at 12:21 AM, Ulf Wiger <ulf@REDACTED> wrote:

> 18 jul 2013 kl. 09:04 skrev Jay Nelson <jay@REDACTED>:
> 
>> 2) ets:update_counter(Tab, Key, Cmd)
>>    where Cmd also allows:
>> 
>>  {Field_Pos, Inc, Thresh, rollback}
>> 
>>    Do not change value, but return existing value if Thresh violated
> 
> What should it return otherwise?
> 
> BR,
> Ulf W
> 
> Ulf Wiger, Feuerlabs, Inc.
> http://feuerlabs.com




More information about the erlang-questions mailing list