Package org.springframework.data.redis.serializer

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


  @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

    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

  @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

    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

      throw new RuntimeException("Cannot init XStream", ex);
    }
    OxmSerializer serializer = new OxmSerializer(xstream, xstream);
    JacksonJsonRedisSerializer<Person> jsonSerializer = new JacksonJsonRedisSerializer<Person>(Person.class);
    Jackson2JsonRedisSerializer<Person> jackson2JsonSerializer = new Jackson2JsonRedisSerializer<Person>(Person.class);
    StringRedisSerializer stringSerializer = new StringRedisSerializer();

    // create Jedis Factory
    ObjectFactory<String> stringFactory = new StringObjectFactory();
    ObjectFactory<Person> personFactory = new PersonObjectFactory();
    ObjectFactory<byte[]> rawFactory = new RawObjectFactory();
View Full Code Here

   *
   * @see #setSerializer(RedisSerializer)
   * @see JdkSerializationRedisSerializer
   */
  protected void initDefaultStrategies() {
    RedisSerializer<String> serializer = new StringRedisSerializer();
    setSerializer(serializer);
    setStringSerializer(serializer);
  }
View Full Code Here

    ArgumentCaptor<byte[]> valueCaptor = ArgumentCaptor.forClass(byte[].class);

    verify(redisTemplate.getConnectionFactory().getConnection(), times(1)).zAdd(keyCaptor.capture(), eq(0D),
        valueCaptor.capture());

    Assert.assertThat(new StringRedisSerializer().deserialize(keyCaptor.getValue()).toString(),
        IsEqual.equalTo("bar~keys"));
  }
View Full Code Here

  /**
   * Constructs a new <code>StringRedisTemplate</code> instance. {@link #setConnectionFactory(RedisConnectionFactory)}
   * and {@link #afterPropertiesSet()} still need to be called.
   */
  public StringRedisTemplate() {
    RedisSerializer<String> stringSerializer = new StringRedisSerializer();
    setKeySerializer(stringSerializer);
    setValueSerializer(stringSerializer);
    setHashKeySerializer(stringSerializer);
    setHashValueSerializer(stringSerializer);
  }
View Full Code Here

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

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

TOP

Related Classes of org.springframework.data.redis.serializer.StringRedisSerializer

Copyright © 2018 www.massapicom. 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.