Package org.apache.storm.state
Interface KeyValueState<K,V>
- All Known Implementing Classes:
InMemoryKeyValueState
,RedisKeyValueState
A state that supports key-value mappings.
-
Method Summary
Modifier and TypeMethodDescriptionDeletes the value mapped to the key, if there is any.Returns the value mapped to the key.Returns the value mapped to the key or defaultValue if no mapping is found.void
Maps the value with the key.Methods inherited from interface java.lang.Iterable
forEach, iterator, spliterator
Methods inherited from interface org.apache.storm.state.State
commit, commit, prepareCommit, rollback
-
Method Details
-
put
Maps the value with the key.- Parameters:
key
- the keyvalue
- the value
-
get
Returns the value mapped to the key.- Parameters:
key
- the key- Returns:
- the value or null if no mapping is found
-
get
Returns the value mapped to the key or defaultValue if no mapping is found.- Parameters:
key
- the keydefaultValue
- the value to return if no mapping is found- Returns:
- the value or defaultValue if no mapping is found
-
delete
Deletes the value mapped to the key, if there is any.- Parameters:
key
- the key
-