Counter

Counter

This class contains methods and parameters for Distributed Counter.


Constructor

# new Counter(key, cache, options, cls)

Parameters:
Name Type Description
key String

key

cache Cache

cache instance

options WriteThruOptions

indicates options for writethruoptions

cls JsonDataType

indicates type of json data

Methods

# (async) addChangeListener(dataTypeDataChangeListener, eventType, dataFilter)

Registers a notifictaion for listening the value change in counter.

Parameters:
Name Type Description
dataTypeDataChangeListener DataStructureDataChangeListener

callback method

eventType Array.<EventType>

indicates eventtype on which callback method will be called

dataFilter DataTypeEventDataFilter

indicates type of data that will be recieved

# (async) compareTo(value) → {Number}

Compare the values with counter

Parameters:
Name Type Description
value Object

indicates value that will be compared to counter value

Returns:
Type
Number

# (async) decrement() → {Number}

decrement the value of distributed counter by one.

Returns:
Type
Number

# (async) decrementBy(value) → {Number}

decrement the value of distributed counter by the amount specified.

Parameters:
Name Type Description
value Number

indicates value that will be substracted

Returns:
Type
Number

# (async) equals(value) → {boolean}

Parameters:
Name Type Description
value Object

indicates value that will be compared to counter value

Returns:
Type
boolean

# (async) getValue() → {Number}

Get the given value of the counter.

Returns:
Type
Number

# (async) increment() → {Number}

increment the value of distributed counter by one.

Returns:
Type
Number

# (async) incrementBy(value) → {Number}

Increment the value of distributed counter by the amount specified.

Parameters:
Name Type Description
value Number

indicates value that will be added

Returns:
Type
Number

# (async) removeChangeListener(dataTypeDataChangeListener, eventType)

UnRegisters a notifictaion for listening the value change in counter.

Parameters:
Name Type Description
dataTypeDataChangeListener DataStructureDataChangeListener

callback method

eventType Array.<EventType>

indicates eventtype on which callback method will be called

# (async) setValue(value) → {Number}

Sets the given value of the counter.

Parameters:
Name Type Description
value Number

value in number which will be stored in counter

Returns:
Type
Number

# toString()

returns the stringified name of class