Examples of StringRedisSerializer


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

   * @param connection Redis connection
   */
  public DefaultStringRedisConnection(RedisConnection connection) {
    Assert.notNull(connection, "connection is required");
    this.delegate = connection;
    this.serializer = new StringRedisSerializer();
  }
View Full Code Here

Examples of org.springframework.data.keyvalue.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.keyvalue.redis.serializer.StringRedisSerializer

   *
   * @see #setSerializer(RedisSerializer)
   * @see JdkSerializationRedisSerializer
   */
  protected void initDefaultStrategies() {
    setSerializer(new StringRedisSerializer());
  }
View Full Code Here

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

    this(redisCounter, factory, 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.keyvalue.redis.serializer.StringRedisSerializer

    this(redisCounter, factory, Long.valueOf(initialValue));
  }

  private RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, Long initialValue) {
    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

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

    if (this.redisTemplate != null) {
      return this.redisTemplate;
    }
    RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
    template.setConnectionFactory(this.redisAvailableRule.getResource());
    template.setKeySerializer(new StringRedisSerializer());
    template.setEnableDefaultSerializer(false);
    template.afterPropertiesSet();
    this.redisTemplate = template;
    return template;
  }
View Full Code Here

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

  @Test
  public void testDefaultPayloadSerializer() throws Exception {
    RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
    template.setConnectionFactory(connectionFactory);
    template.setKeySerializer(new StringRedisSerializer());
    template.afterPropertiesSet();

    adapter.afterPropertiesSet();
    adapter.start();
View Full Code Here

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

  }

  @Test
  public void testDefaultMsgSerializer() throws Exception {
    RedisTemplate<String, Message<String>> template = new RedisTemplate<String, Message<String>>();
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new JdkSerializationRedisSerializer());
    template.setConnectionFactory(connectionFactory);
    template.afterPropertiesSet();

    adapter.setExpectMessage(true);
View Full Code Here

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

  @SuppressWarnings("unchecked")
  @Test
  public void testNoSerializer() throws Exception {
    RedisTemplate<String, byte[]> template = new RedisTemplate<String, byte[]>();
    template.setEnableDefaultSerializer(false);
    template.setKeySerializer(new StringRedisSerializer());
    template.setConnectionFactory(connectionFactory);
    template.afterPropertiesSet();

    adapter.setSerializer(null);
    adapter.afterPropertiesSet();
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.