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 aRedisCachewith the set values.HawaiiRedisCacheBuilderwithCacheConfiguration(RedisConfigurationProperties cacheConfiguration)Sets theRedisConfigurationPropertiesfor this builder.HawaiiRedisCacheBuilderwithHawaiiTime(HawaiiTime hawaiiTime)Sets theHawaiiTimefor this builder.HawaiiRedisCacheBuilderwithJedisConnectionFactory(org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory)Sets theJedisConnectionFactoryfor this builder.HawaiiRedisCacheBuilderwithKeyPrefix(String keyPrefix)Sets the key prefix for this builder.HawaiiRedisCacheBuilderwithTimeOut(Long timeOutInMinutes)Sets the the timeout for the redis cache.HawaiiRedisCacheBuilderwithValueSerializer(org.springframework.data.redis.serializer.RedisSerializer<?> valueSerializer)Sets theRedisSerializerfor 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 theRedisConfigurationPropertiesfor this builder.- Parameters:
cacheConfiguration- the redis configuration properties- Returns:
- new
HawaiiRedisCacheBuilderwith the new set values
-
withJedisConnectionFactory
public HawaiiRedisCacheBuilder withJedisConnectionFactory(org.springframework.data.redis.connection.jedis.JedisConnectionFactory jedisConnectionFactory)
Sets theJedisConnectionFactoryfor this builder.- Parameters:
jedisConnectionFactory- the connection factory used to build the cache- Returns:
- new
HawaiiRedisCacheBuilderwith 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
HawaiiRedisCacheBuilderwith 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
HawaiiRedisCacheBuilderwith the new set values
-
withHawaiiTime
public HawaiiRedisCacheBuilder withHawaiiTime(HawaiiTime hawaiiTime)
Sets theHawaiiTimefor this builder.- Parameters:
hawaiiTime- time to use forRedisCache- Returns:
- new
HawaiiRedisCacheBuilderwith the new set values
-
withValueSerializer
public HawaiiRedisCacheBuilder withValueSerializer(org.springframework.data.redis.serializer.RedisSerializer<?> valueSerializer)
Sets theRedisSerializerfor this builder.- Parameters:
valueSerializer- the value serializer- Returns:
- new
HawaiiRedisCacheBuilderwith the new set values
-
build
public <V> RedisCache<V> build()
Builds aRedisCachewith the set values.- Type Parameters:
V- Type of theRedisCache- Returns:
- a new
RedisCache
-
-