Package org.togglz.redis
Class RedisLettuceStateRepository
- java.lang.Object
-
- org.togglz.redis.RedisLettuceStateRepository
-
- All Implemented Interfaces:
StateRepository
public class RedisLettuceStateRepository extends Object implements StateRepository
A state repository which stores the feature state in Redis using Lettuce client.The class provides a builder which can be used to configure the state repository instance (e.g. StatefulConnection pool, key prefix).
A state repository is able to work in standalone mode (using StatefulRedisConnection) and cluster mode (using StatefulRedisClusterConnection)
Lettuce doesn't provide default client creator (localhost as a default host, 6379 as a default port) so an exception is made when StatefulConnection pool is not set correctly
- Author:
- Jakub Klebek
-
-
Nested Class Summary
Nested Classes Modifier and Type Class Description static classRedisLettuceStateRepository.BuilderBuilder for aRedisLettuceStateRepository.
-
Field Summary
Fields Modifier and Type Field Description static StringENABLED_FIELDprotected StringkeyPrefixstatic StringPARAMETER_PREFIXstatic intPARAMETER_PREFIX_LENGTHprotected org.apache.commons.pool2.impl.GenericObjectPool<io.lettuce.core.api.StatefulConnection<String,String>>poolstatic StringSTRATEGY_FIELD
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description FeatureStategetFeatureState(Feature feature)voidsetFeatureState(FeatureState featureState)
-
-
-
Field Detail
-
ENABLED_FIELD
public static final String ENABLED_FIELD
- See Also:
- Constant Field Values
-
STRATEGY_FIELD
public static final String STRATEGY_FIELD
- See Also:
- Constant Field Values
-
PARAMETER_PREFIX
public static final String PARAMETER_PREFIX
- See Also:
- Constant Field Values
-
PARAMETER_PREFIX_LENGTH
public static final int PARAMETER_PREFIX_LENGTH
-
pool
protected final org.apache.commons.pool2.impl.GenericObjectPool<io.lettuce.core.api.StatefulConnection<String,String>> pool
-
keyPrefix
protected final String keyPrefix
-
-
Method Detail
-
getFeatureState
public FeatureState getFeatureState(Feature feature)
- Specified by:
getFeatureStatein interfaceStateRepository
-
setFeatureState
public void setFeatureState(FeatureState featureState)
- Specified by:
setFeatureStatein interfaceStateRepository
-
-