Package org.apache.storm.redis.trident.state

## Class AbstractRedisStateUpdater<T extends State>

- java.lang.Object
- - org.apache.storm.trident.operation.BaseOperation
  - - org.apache.storm.trident.state.BaseStateUpdater<T>
    - - org.apache.storm.redis.trident.state.AbstractRedisStateUpdater<T>

- Type Parameters:
    `T` - type of State
  All Implemented Interfaces:
    `Serializable`, `Operation`, `StateUpdater<T>`
  Direct Known Subclasses:
    `RedisClusterStateUpdater`, `RedisStateUpdater`

      public abstract class AbstractRedisStateUpdater<T extends State>
      extends BaseStateUpdater<T>

  AbstractRedisStateUpdater is base class of any RedisStateUpdater, which implements BaseStateUpdater.

  Derived classes should provide how to update (key, value) pairs to Redis, and AbstractRedisStateUpdater takes care of rest things.

  See Also:
    Serialized Form

- - ### Field Summary

    Fields
    Modifier and Type | Field | Description
    --- | --- | ---
    `protected String` | `additionalKey` |
    `protected RedisDataTypeDescription.RedisDataType` | `dataType` |
    `protected int` | `expireIntervalSec` |

  - ### Constructor Summary

    Constructors
    Constructor | Description
    --- | ---
    `AbstractRedisStateUpdater​(RedisStoreMapper storeMapper)` | Constructor.

  - ### Method Summary

    All Methods Instance Methods Abstract Methods Concrete Methods
    Modifier and Type | Method | Description
    --- | --- | ---
    `void` | `setExpireInterval​(int expireIntervalSec)` | Sets expire (time to live) if needed.
    `void` | `updateState​(T state, List<TridentTuple> inputs, TridentCollector collector)`
    `protected abstract void` | `updateStatesToRedis​(T state, Map<String,​String> keyToValue)` | Updates (key, value) pairs to Redis.

    - ### Methods inherited from class org.apache.storm.trident.operation.BaseOperation

      `cleanup, prepare`

    - ### Methods inherited from class java.lang.Object

      `clone, equals, finalize, getClass, hashCode, notify, notifyAll, toString, wait, wait, wait`

    - ### Methods inherited from interface org.apache.storm.trident.operation.Operation

      `cleanup, prepare`

- - ### Field Detail

    - #### dataType

          protected final RedisDataTypeDescription.RedisDataType dataType

    - #### additionalKey

          protected final String additionalKey

    - #### expireIntervalSec

          protected int expireIntervalSec

  - ### Constructor Detail

    - #### AbstractRedisStateUpdater

          public AbstractRedisStateUpdater​(RedisStoreMapper storeMapper)

      Constructor.
      Parameters:
        `storeMapper` - mapper for storing

  - ### Method Detail

    - #### setExpireInterval

          public void setExpireInterval​(int expireIntervalSec)

      Sets expire (time to live) if needed.
      Parameters:
        `expireIntervalSec` - time to live in seconds

    - #### updateState

          public void updateState​(T state,
                                  List<TridentTuple> inputs,
                                  TridentCollector collector)

    - #### updateStatesToRedis

          protected abstract void updateStatesToRedis​(T state,
                                                      Map<String,​String> keyToValue)

      Updates (key, value) pairs to Redis.
      Parameters:
        `state` - State for handling query
        `keyToValue` - (key, value) pairs