Examples of StringRedisSerializer


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

      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

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

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

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

    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

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

  /**
   * 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

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

    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

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

  @Test
  public void testShouldBeAbleToUseRedisAtomicLongWithProperlyConfiguredRedisTemplate() {

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

    RedisAtomicLong ral = new RedisAtomicLong("DATAREDIS-317.atomicLong", template);
    ral.set(32L);
View Full Code Here

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

  private RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory, Double initialValue) {
    Assert.hasText(redisCounter, "a valid counter name is required");
    Assert.notNull(factory, "a valid factory is required");

    RedisTemplate<String, Double> redisTemplate = new RedisTemplate<String, Double>();
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new GenericToStringSerializer<Double>(Double.class));
    redisTemplate.setExposeConnection(true);
    redisTemplate.setConnectionFactory(factory);
    redisTemplate.afterPropertiesSet();
View Full Code Here

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

    this(redisCounter, template, Integer.valueOf(initialValue));
  }

  private RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory, Integer initialValue) {
    RedisTemplate<String, Integer> redisTemplate = new RedisTemplate<String, Integer>();
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new GenericToStringSerializer<Integer>(Integer.class));
    redisTemplate.setExposeConnection(true);
    redisTemplate.setConnectionFactory(factory);
    redisTemplate.afterPropertiesSet();
View Full Code Here

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

  private RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, Long initialValue) {
    Assert.hasText(redisCounter, "a valid counter name is required");
    Assert.notNull(factory, "a valid factory is required");

    RedisTemplate<String, Long> redisTemplate = new RedisTemplate<String, Long>();
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new GenericToStringSerializer<Long>(Long.class));
    redisTemplate.setExposeConnection(true);
    redisTemplate.setConnectionFactory(factory);
    redisTemplate.afterPropertiesSet();
View Full Code Here

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

  @SuppressWarnings("unchecked")
  @Test
  public void testExecuteBooleanResult() {
    this.template = new RedisTemplate<String, Long>();
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new GenericToStringSerializer<Long>(Long.class));
    template.setConnectionFactory(connFactory);
    template.afterPropertiesSet();
    DefaultRedisScript<Boolean> script = new DefaultRedisScript<Boolean>();
    script.setLocation(new ClassPathResource("org/springframework/data/redis/core/script/cas.lua"));
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.