Search in sources :

Example 36 with StringRedisSerializer

use of org.springframework.data.redis.serializer.StringRedisSerializer in project benchmark by seelunzi.

the class RedisConfig method redisTemplate.

@Bean
public RedisTemplate<String, Serializable> redisTemplate() {
    RedisTemplate<String, Serializable> template = new RedisTemplate<String, Serializable>();
    template.setConnectionFactory(jedisConnectionFactory());
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new RedisObjectSerializer());
    return template;
}
Also used : StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) Serializable(java.io.Serializable) RedisTemplate(org.springframework.data.redis.core.RedisTemplate) Bean(org.springframework.context.annotation.Bean)

Example 37 with StringRedisSerializer

use of org.springframework.data.redis.serializer.StringRedisSerializer in project rdbcache by rdbcache.

the class RedisConfig method redisKeyInfoTemplate.

@Bean
public RedisKeyInfoTemplate redisKeyInfoTemplate() {
    RedisKeyInfoTemplate template = new RedisKeyInfoTemplate();
    template.setConnectionFactory(redisConnectionFactory());
    template.setKeySerializer(new StringRedisSerializer());
    template.setHashKeySerializer(new StringRedisSerializer());
    template.setHashValueSerializer(new Jackson2JsonRedisSerializer<KeyInfo>(KeyInfo.class));
    return template;
}
Also used : StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) KeyInfo(doitincloud.rdbcache.models.KeyInfo) Bean(org.springframework.context.annotation.Bean)

Example 38 with StringRedisSerializer

use of org.springframework.data.redis.serializer.StringRedisSerializer in project WTFDYUM by jchampemont.

the class RedisConfiguration method longRedisTemplate.

@Bean
public RedisTemplate<String, Long> longRedisTemplate() {
    final RedisTemplate<String, Long> template = new RedisTemplate<>();
    template.setConnectionFactory(redisConnectionFactory());
    template.setKeySerializer(new StringRedisSerializer());
    template.setHashKeySerializer(new LongRedisSerializer());
    template.setValueSerializer(new LongRedisSerializer());
    return template;
}
Also used : LongRedisSerializer(com.jeanchampemont.wtfdyum.utils.LongRedisSerializer) StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) RedisTemplate(org.springframework.data.redis.core.RedisTemplate) Bean(org.springframework.context.annotation.Bean)

Example 39 with StringRedisSerializer

use of org.springframework.data.redis.serializer.StringRedisSerializer in project WTFDYUM by jchampemont.

the class RedisConfiguration method eventRedisTemplate.

@Bean
public RedisTemplate<String, Event> eventRedisTemplate() {
    final RedisTemplate<String, Event> template = new RedisTemplate<>();
    template.setConnectionFactory(redisConnectionFactory());
    template.setKeySerializer(new StringRedisSerializer());
    template.setHashKeySerializer(jsonSerializer(Event.class, objectMapper()));
    template.setValueSerializer(jsonSerializer(Event.class, objectMapper()));
    return template;
}
Also used : StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) RedisTemplate(org.springframework.data.redis.core.RedisTemplate) Event(com.jeanchampemont.wtfdyum.dto.Event) Bean(org.springframework.context.annotation.Bean)

Example 40 with StringRedisSerializer

use of org.springframework.data.redis.serializer.StringRedisSerializer in project WTFDYUM by jchampemont.

the class RedisConfiguration method principalRedisTemplate.

@Bean
public RedisTemplate<String, Principal> principalRedisTemplate() {
    final RedisTemplate<String, Principal> template = new RedisTemplate<>();
    template.setConnectionFactory(redisConnectionFactory());
    template.setKeySerializer(new StringRedisSerializer());
    template.setHashKeySerializer(jsonSerializer(Principal.class, objectMapper()));
    template.setValueSerializer(jsonSerializer(Principal.class, objectMapper()));
    return template;
}
Also used : StringRedisSerializer(org.springframework.data.redis.serializer.StringRedisSerializer) RedisTemplate(org.springframework.data.redis.core.RedisTemplate) Principal(com.jeanchampemont.wtfdyum.dto.Principal) Bean(org.springframework.context.annotation.Bean)

Aggregations

StringRedisSerializer (org.springframework.data.redis.serializer.StringRedisSerializer)46 RedisTemplate (org.springframework.data.redis.core.RedisTemplate)30 Bean (org.springframework.context.annotation.Bean)17 StringRedisTemplate (org.springframework.data.redis.core.StringRedisTemplate)16 Test (org.junit.Test)14 JdkSerializationRedisSerializer (org.springframework.data.redis.serializer.JdkSerializationRedisSerializer)14 RedisAvailable (org.springframework.integration.redis.rules.RedisAvailable)13 DataAccessException (org.springframework.dao.DataAccessException)7 RedisConnection (org.springframework.data.redis.connection.RedisConnection)7 RedisCallback (org.springframework.data.redis.core.RedisCallback)7 BeanFactory (org.springframework.beans.factory.BeanFactory)5 Date (java.util.Date)4 QueueChannel (org.springframework.integration.channel.QueueChannel)4 ObjectMapper (com.fasterxml.jackson.databind.ObjectMapper)3 CountDownLatch (java.util.concurrent.CountDownLatch)3 Jackson2JsonRedisSerializer (org.springframework.data.redis.serializer.Jackson2JsonRedisSerializer)3 Message (org.springframework.messaging.Message)3 PollableChannel (org.springframework.messaging.PollableChannel)3 ErrorMessage (org.springframework.messaging.support.ErrorMessage)3 HashMap (java.util.HashMap)2