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 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 null
        from - - the very 1st result
        size - - the size of the page
        Returns:
        - list of CounterDTO, where key is counter key, Value is current counter value;