Class: ReplicatedCounter

akkaserverless.replicatedentity. ReplicatedCounter

A Replicated Counter data type.

A counter that can be incremented and decremented.

The value is stored as a 64-bit signed long, hence values over 2^63 - 1 and less than 2^63 can't be represented.


new ReplicatedCounter()

Implements:

Members


<readonly> longValue :Long

The value as a long.

Type:
  • Long

<readonly> value :number

The value as a number. Note that once the value exceeds 2^53, this will not be an accurate representation of the value. If you expect it to exceed 2^53, module:akkaserverless.replicatedentity.ReplicatedCounter#longValue should be used instead.

Type:
  • number

Methods


decrement(decrement)

Decrement the counter by the given number.

Parameters:
Name Type Description
decrement Long | number

The amount to decrement the counter by. If negative, it will be incremented instead.

Returns:

This counter.

Type
module:akkaserverless.replicatedentity.ReplicatedCounter

increment(increment)

Increment the counter by the given number.

Parameters:
Name Type Description
increment Long | number

The amount to increment the counter by. If negative, it will be decremented instead.

Returns:

This counter.

Type
module:akkaserverless.replicatedentity.ReplicatedCounter