Package org.openiam.esb.core.service
Interface CounterService
-
- All Known Implementing Classes:
CounterServiceImpl
public interface CounterService
- Author:
- zaporozhec The service implements the method 'incrementAndGet' to get next value in series. If series with given key hasn't existed before, then it will be created with default initial value 1.
-
-
Method Summary
All Methods Instance Methods Abstract Methods Modifier and Type Method Description CounterDTO
create(CounterDTO counterDTO)
Create a new counter with given initial valuevoid
delete(String key)
Delete counter by Keylong
incrementAndGet(String key)
This is system wide thread-safe method to get next value in the series.CounterListResponse
list(String keyPattern, int from, int size)
List all counters by page/long
nonSynchronizedIncrementAndGet(String key)
This is system wide NOT thread safe method to get next value in the series.
-
-
-
Method Detail
-
incrementAndGet
long incrementAndGet(String key) throws BasicDataServiceException
This is system wide thread-safe method to get next value in the series. The synchronization is based on Redis Lock- Parameters:
key
- - the series key- Returns:
- next value in series.
- Throws:
BasicDataServiceException
- - in case key is null or empy string.
-
nonSynchronizedIncrementAndGet
long nonSynchronizedIncrementAndGet(String key)
This is system wide NOT thread safe method to get next value in the series.- Parameters:
key
- - the series key- Returns:
- next value in series.
-
delete
void delete(String key)
Delete counter by Key- Parameters:
key
- - the Key of counter that should be deleted.
-
list
CounterListResponse list(String keyPattern, int from, int size)
List all counters by page/- Parameters:
keyPattern
- - pattern for key search, can be nullfrom
- - the very 1st resultsize
- - the size of the page- Returns:
- - list of
CounterDTO
, where key is counter key, Value is current counter value;
-
create
CounterDTO create(CounterDTO counterDTO) throws BasicDataServiceException
Create a new counter with given initial value- Parameters:
counterDTO
- - Dto with Key and initial value- Throws:
BasicDataServiceException
-
-