Package org.hawaiiframework.cache.redis
Class HawaiiRedisCacheBuilder
- java.lang.Object
-
- org.hawaiiframework.cache.redis.HawaiiRedisCacheBuilder
-
public class HawaiiRedisCacheBuilder extends Object
Builder class for the creation of aRedisCache
.Default values are as followed:
Prefix : Hawaii, Key Serializer :
StringRedisSerializer
, Value Serializer :JdkSerializationRedisSerializer
- Author:
- Richard Kohlen
-
-
Constructor Summary
Constructors Constructor Description HawaiiRedisCacheBuilder(RedisConfigurationProperties cacheConfiguration, org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory, HawaiiTime hawaiiTime)
Constructor.
-
Method Summary
All Methods Instance Methods Concrete Methods Modifier and Type Method Description <V> RedisCache<V>
build()
Builds aRedisCache
with the set values.HawaiiRedisCacheBuilder
withCacheConfiguration(RedisConfigurationProperties cacheConfiguration)
Sets theRedisConfigurationProperties
for this builder.HawaiiRedisCacheBuilder
withHawaiiTime(HawaiiTime hawaiiTime)
Sets theHawaiiTime
for this builder.HawaiiRedisCacheBuilder
withJedisConnectionFactory(org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory)
Sets theJedisConnectionFactory
for this builder.HawaiiRedisCacheBuilder
withKeyPrefix(String keyPrefix)
Sets the key prefix for this builder.HawaiiRedisCacheBuilder
withTimeOut(Long timeOutInMinutes)
Sets the the timeout for the redis cache.HawaiiRedisCacheBuilder
withValueSerializer(org.springframework.data.redis.serializer.RedisSerializer<?> valueSerializer)
Sets theRedisSerializer
for this builder.
-
-
-
Constructor Detail
-
HawaiiRedisCacheBuilder
public HawaiiRedisCacheBuilder(RedisConfigurationProperties cacheConfiguration, org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory, HawaiiTime hawaiiTime)
Constructor.- Parameters:
cacheConfiguration
- The redis configurationjedisConnectionFactory
- The Jedis connection factory
-
-
Method Detail
-
withCacheConfiguration
public HawaiiRedisCacheBuilder withCacheConfiguration(RedisConfigurationProperties cacheConfiguration)
Sets theRedisConfigurationProperties
for this builder.- Parameters:
cacheConfiguration
- the redis configuration properties- Returns:
- new
HawaiiRedisCacheBuilder
with the new set values
-
withJedisConnectionFactory
public HawaiiRedisCacheBuilder withJedisConnectionFactory(org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory)
Sets theJedisConnectionFactory
for this builder.- Parameters:
jedisConnectionFactory
- the connection factory used to build the cache- Returns:
- new
HawaiiRedisCacheBuilder
with the new set values
-
withTimeOut
public HawaiiRedisCacheBuilder withTimeOut(Long timeOutInMinutes)
Sets the the timeout for the redis cache. When this is not set- Parameters:
timeOutInMinutes
- the timeout in minutes to set.- Returns:
- new
HawaiiRedisCacheBuilder
with the new set values
-
withKeyPrefix
public HawaiiRedisCacheBuilder withKeyPrefix(String keyPrefix)
Sets the key prefix for this builder.- Parameters:
keyPrefix
- the prefix to use when building the redis cache- Returns:
- new
HawaiiRedisCacheBuilder
with the new set values
-
withHawaiiTime
public HawaiiRedisCacheBuilder withHawaiiTime(HawaiiTime hawaiiTime)
Sets theHawaiiTime
for this builder.- Parameters:
hawaiiTime
- time to use forRedisCache
- Returns:
- new
HawaiiRedisCacheBuilder
with the new set values
-
withValueSerializer
public HawaiiRedisCacheBuilder withValueSerializer(org.springframework.data.redis.serializer.RedisSerializer<?> valueSerializer)
Sets theRedisSerializer
for this builder.- Parameters:
valueSerializer
- the value serializer- Returns:
- new
HawaiiRedisCacheBuilder
with the new set values
-
build
public <V> RedisCache<V> build()
Builds aRedisCache
with the set values.- Type Parameters:
V
- Type of theRedisCache
- Returns:
- a new
RedisCache
-
-