Constructor
# new Counter(key, cache, options, cls)
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.
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
Name | Type | Description |
---|---|---|
value |
Object | indicates value that will be compared to counter value |
- Type
- Number
# (async) decrement() → {Number}
decrement the value of distributed counter by one.
- Type
- Number
# (async) decrementBy(value) → {Number}
decrement the value of distributed counter by the amount specified.
Name | Type | Description |
---|---|---|
value |
Number | indicates value that will be substracted |
- Type
- Number
# (async) equals(value) → {boolean}
Name | Type | Description |
---|---|---|
value |
Object | indicates value that will be compared to counter value |
- Type
- boolean
# (async) getValue() → {Number}
Get the given value of the counter.
- Type
- Number
# (async) increment() → {Number}
increment the value of distributed counter by one.
- Type
- Number
# (async) incrementBy(value) → {Number}
Increment the value of distributed counter by the amount specified.
Name | Type | Description |
---|---|---|
value |
Number | indicates value that will be added |
- Type
- Number
# (async) removeChangeListener(dataTypeDataChangeListener, eventType)
UnRegisters a notifictaion for listening the value change in counter.
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.
Name | Type | Description |
---|---|---|
value |
Number | value in number which will be stored in counter |
- Type
- Number
# toString()
returns the stringified name of class