Module spillway

Function Index

cur/1Return the current counter value.
enter/2Attempt to increment the named counter, respecting the given limit.
enter/3
leave/1Attempt to decrement the named counter, with a lower limit of 0.
leave/2
state/0For debug purposes.

Function Details

cur/1

cur(Name::term()) -> non_neg_integer()

Return the current counter value. It will return 0 if it does not exist.

enter/2

enter(Name::term(), Limit::non_neg_integer()) -> false | {true, non_neg_integer()}

Attempt to increment the named counter, respecting the given limit. If the counter was successfully incremented, return {true, NewValue}. Otherwise, return false.

enter/3

enter(Name::term(), Size::non_neg_integer(), Limit::non_neg_integer()) -> false | {true, non_neg_integer()}

leave/1

leave(Name::term()) -> non_neg_integer()

Attempt to decrement the named counter, with a lower limit of 0. Return the new value. The counter must already exist.

leave/2

leave(Name::term(), Size::non_neg_integer()) -> non_neg_integer()

state/0

state() -> any()

For debug purposes. Returns the state of all counters.


Generated by EDoc