Provides access to named counters, a simple transactional counter mechanism scoped to the current admin organisation. Reached from JS as the registered service counterManager. Counter values are updated on a dedicated single-threaded executor, using a per-counter last-issued-value cache as a safety net, so concurrent increments from the same server cannot hand out a value that has already been issued.
Group: Managers
Implements: StartableService
Methods
get(String name)
Returns: NamedCounter
Looks up the named counter for the current admin organisation without locking it or changing its value.
| Parameter | Description |
|---|---|
name | the counter's name |
increment(String name)
Returns: long
Returns a new value from the named counter for the current admin organisation, creating the counter if it does not already exist. This updates the counter's stored value, so is more expensive than get.
| Parameter | Description |
|---|---|
name | the counter's name |