Examples of StringRedisSerializer


Examples of org.springframework.data.redis.serializer.StringRedisSerializer

   */
  public RedisAggregateCounterRepository(RedisConnectionFactory redisConnectionFactory) {
    super("aggregatecounters", redisConnectionFactory);
    RedisTemplate<String, String> redisTemplate = new RedisTemplate<String, String>();
    redisTemplate.setConnectionFactory(redisConnectionFactory);
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new StringRedisSerializer());
    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashValueSerializer(new GenericToStringSerializer<Long>(Long.class));
    redisTemplate.afterPropertiesSet();
    hashOperations = redisTemplate.opsForHash();
    setOperations = redisTemplate.opsForSet();
  }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    }

    @Bean
    public RedisTemplate<String,ExpiringSession> sessionRedisTemplate(RedisConnectionFactory connectionFactory) {
        RedisTemplate<String, ExpiringSession> template = new RedisTemplate<String, ExpiringSession>();
        template.setKeySerializer(new StringRedisSerializer());
        template.setHashKeySerializer(new StringRedisSerializer());
        template.setConnectionFactory(connectionFactory);
        return template;
    }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    }

    @Bean
    public RedisTemplate<String,String> expirationRedisTemplate(RedisConnectionFactory connectionFactory) {
        RedisTemplate<String, String> template = new RedisTemplate<String, String>();
        template.setKeySerializer(new StringRedisSerializer());
        template.setHashKeySerializer(new StringRedisSerializer());
        template.setConnectionFactory(connectionFactory);
        return template;
    }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    @SuppressWarnings("rawtypes")
    private static RedisTemplate createDefaultTemplate(RedisConnectionFactory connectionFactory) {
        Assert.notNull(connectionFactory,"connectionFactory cannot be null");
        RedisTemplate<String, ExpiringSession> template = new RedisTemplate<String, ExpiringSession>();
        template.setKeySerializer(new StringRedisSerializer());
        template.setHashKeySerializer(new StringRedisSerializer());
        template.setConnectionFactory(connectionFactory);
        return template;
    }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

class RedisUtils {

  static <K, V> RedisTemplate<K, V> createRedisTemplate(
      RedisConnectionFactory connectionFactory, Class<V> valueClass) {
    RedisTemplate<K, V> redisTemplate = new RedisTemplate<K, V>();
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new GenericToStringSerializer<V>(valueClass));

    // avoids proxy
    redisTemplate.setExposeConnection(true);
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("a valid value serializer in template is required");

    RedisTemplate<String, Integer> template = new RedisTemplate<String, Integer>();
    template.setKeySerializer(new StringRedisSerializer());
    new RedisAtomicInteger("foo", template);
  }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

  @Test
  public void testShouldBeAbleToUseRedisAtomicIntegerWithProperlyConfiguredRedisTemplate() {

    RedisTemplate<String, Integer> template = new RedisTemplate<String, Integer>();
    template.setConnectionFactory(factory);
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new GenericToStringSerializer<Integer>(Integer.class));
    template.afterPropertiesSet();

    RedisAtomicInteger ral = new RedisAtomicInteger("DATAREDIS-317.atomicInteger", template);
    ral.set(32);
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    expectedException.expect(IllegalArgumentException.class);
    expectedException.expectMessage("a valid value serializer in template is required");

    RedisTemplate<String, Double> template = new RedisTemplate<String, Double>();
    template.setKeySerializer(new StringRedisSerializer());
    new RedisAtomicDouble("foo", template);
  }
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

  @Test
  public void testShouldBeAbleToUseRedisAtomicDoubleWithProperlyConfiguredRedisTemplate() {

    RedisTemplate<String, Double> template = new RedisTemplate<String, Double>();
    template.setConnectionFactory(factory);
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new GenericToStringSerializer<Double>(Double.class));
    template.afterPropertiesSet();

    RedisAtomicDouble ral = new RedisAtomicDouble("DATAREDIS-317.atomicDouble", template);
    ral.set(32.23);
View Full Code Here

Examples of org.springframework.data.redis.serializer.StringRedisSerializer

    JacksonJsonRedisSerializer<Person> jsonSerializer = new JacksonJsonRedisSerializer<Person>(Person.class);
    JacksonJsonRedisSerializer<String> jsonStringSerializer = new JacksonJsonRedisSerializer<String>(String.class);
    Jackson2JsonRedisSerializer<Person> jackson2JsonSerializer = new Jackson2JsonRedisSerializer<Person>(Person.class);
    Jackson2JsonRedisSerializer<String> jackson2JsonStringSerializer = new Jackson2JsonRedisSerializer<String>(
        String.class);
    StringRedisSerializer stringSerializer = new StringRedisSerializer();

    PoolConfig defaultPoolConfig = new PoolConfig();
    defaultPoolConfig.setMaxActive(1000);

    // create Jedis Factory
View Full Code Here
TOP
Copyright © 2018 www.massapi.com. All rights reserved.
All source code are property of their respective owners. Java is a trademark of Sun Microsystems, Inc and owned by ORACLE Inc. Contact coftware#gmail.com.