Package org.apache.synapse.commons.throttle.core

## Interface DistributedCounterManager

-     public interface DistributedCounterManager

  This interface used to replicate throttling counters and windows in distributed manner.

- - ### Method Summary

    All Methods Instance Methods Abstract Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `long` | `addAndGetCounter​(String key, long value)` | This method used to add and return the distributed counter value.
    `long` | `asyncGetAndAddCounter​(String key, long value)` | This method used to update distributed counter asynchronously.
    `long` | `asyncGetAndAlterCounter​(String key, long value)` | This method used to alter the DistributedCounter.
    `long` | `getCounter​(String key)` | Returns the Distributed Counter for specific key.
    `long` | `getTimestamp​(String key)` | This method returns shared TimeStamp of distributed Key.
    `String` | `getType()` |
    `boolean` | `isEnable()` |
    `void` | `removeCounter​(String key)` | This method used to remove specified key.
    `void` | `removeTimestamp​(String key)` | This method removes the timestamp relevant to key.
    `void` | `setCounter​(String key, long value)` | Sets the Distributed counter with value.
    `void` | `setExpiry​(String key, long expiryTimeStamp)` |
    `void` | `setTimestamp​(String key, long timeStamp)` | This method set the Timestamp to distributed map.

- - ### Method Detail

    - #### getCounter

          long getCounter​(String key)

      Returns the Distributed Counter for specific key.
      Parameters:
        `key` - key to check in distributed map.
      Returns:
        value of distributed counter.

    - #### setCounter

          void setCounter​(String key,
                          long value)

      Sets the Distributed counter with value.
      Parameters:
        `key` - key to add in distributed map.
        `value` - value of distributed counter.

    - #### addAndGetCounter

          long addAndGetCounter​(String key,
                                long value)

      This method used to add and return the distributed counter value.
      Parameters:
        `key` - key to add in distributed map.
        `value` - value to add to distributed counter.
      Returns:
        added value of distributed counter.

    - #### removeCounter

          void removeCounter​(String key)

      This method used to remove specified key.
      Parameters:
        `key` - key to check in distributed map.

    - #### asyncGetAndAddCounter

          long asyncGetAndAddCounter​(String key,
                                     long value)

      This method used to update distributed counter asynchronously.
      Parameters:
        `key` - key to check in distributed map.
        `value` - value to add to distributed counter.
      Returns:
        the original distributed counter value.

    - #### asyncGetAndAlterCounter

          long asyncGetAndAlterCounter​(String key,
                                       long value)

      This method used to alter the DistributedCounter.
      Parameters:
        `key` - key to check in distributed map.
        `value` - value of distributed counter.
      Returns:
        the original distributed counter value.

    - #### getTimestamp

          long getTimestamp​(String key)

      This method returns shared TimeStamp of distributed Key.
      Parameters:
        `key` - key to check in distributed map.
      Returns:
        timestamp value of key.

    - #### setTimestamp

          void setTimestamp​(String key,
                            long timeStamp)

      This method set the Timestamp to distributed map.
      Parameters:
        `key` - key to add in distributed map.
        `timeStamp` - timestamp to add.

    - #### removeTimestamp

          void removeTimestamp​(String key)

      This method removes the timestamp relevant to key.
      Parameters:
        `key` - key to check in distributed map.

    - #### isEnable

          boolean isEnable()

    - #### getType

          String getType()

    - #### setExpiry

          void setExpiry​(String key,
                         long expiryTimeStamp)