Package org.springframework.data.keyvalue.redis.core

Examples of org.springframework.data.keyvalue.redis.core.StringRedisTemplate


    jedisConnFactory.setPort(SettingsUtils.getPort());
    jedisConnFactory.setHostName(SettingsUtils.getHost());

    jedisConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> stringTemplate = new StringRedisTemplate(jedisConnFactory);
    RedisTemplate<String, Person> personTemplate = new RedisTemplate<String, Person>();
    personTemplate.setConnectionFactory(jedisConnFactory);
    personTemplate.afterPropertiesSet();

    RedisTemplate<String, String> xstreamStringTemplate = new RedisTemplate<String, String>();
    xstreamStringTemplate.setConnectionFactory(jedisConnFactory);
    xstreamStringTemplate.setDefaultSerializer(serializer);
    xstreamStringTemplate.afterPropertiesSet();

    RedisTemplate<String, Person> xstreamPersonTemplate = new RedisTemplate<String, Person>();
    xstreamPersonTemplate.setConnectionFactory(jedisConnFactory);
    xstreamPersonTemplate.setValueSerializer(serializer);
    xstreamPersonTemplate.afterPropertiesSet();

    // json
    RedisTemplate<String, Person> jsonPersonTemplate = new RedisTemplate<String, Person>();
    jsonPersonTemplate.setConnectionFactory(jedisConnFactory);
    jsonPersonTemplate.setValueSerializer(jsonSerializer);
    jsonPersonTemplate.afterPropertiesSet();

    // jredis
    JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory();
    jredisConnFactory.setUsePool(true);

    jredisConnFactory.setPort(SettingsUtils.getPort());
    jredisConnFactory.setHostName(SettingsUtils.getHost());

    jredisConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> stringTemplateJR = new StringRedisTemplate(jredisConnFactory);
    RedisTemplate<String, Person> personTemplateJR = new RedisTemplate<String, Person>();
    personTemplateJR.setConnectionFactory(jredisConnFactory);
    personTemplateJR.afterPropertiesSet();

    RedisTemplate<String, Person> xstreamStringTemplateJR = new RedisTemplate<String, Person>();
    xstreamStringTemplateJR.setConnectionFactory(jredisConnFactory);
    xstreamStringTemplateJR.setDefaultSerializer(serializer);
    xstreamStringTemplateJR.afterPropertiesSet();

    RedisTemplate<String, Person> xstreamPersonTemplateJR = new RedisTemplate<String, Person>();
    xstreamPersonTemplateJR.setValueSerializer(serializer);
    xstreamPersonTemplateJR.setConnectionFactory(jredisConnFactory);
    xstreamPersonTemplateJR.afterPropertiesSet();

    RedisTemplate<String, Person> jsonPersonTemplateJR = new RedisTemplate<String, Person>();
    jsonPersonTemplateJR.setValueSerializer(jsonSerializer);
    jsonPersonTemplateJR.setConnectionFactory(jredisConnFactory);
    jsonPersonTemplateJR.afterPropertiesSet();


    // rjc
    RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory();
    rjcConnFactory.setUsePool(true);
    rjcConnFactory.setPort(SettingsUtils.getPort());
    rjcConnFactory.setHostName(SettingsUtils.getHost());
    rjcConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> stringTemplateRJC = new StringRedisTemplate(rjcConnFactory);
    RedisTemplate<String, Person> personTemplateRJC = new RedisTemplate<String, Person>();
    personTemplateRJC.setConnectionFactory(rjcConnFactory);
    personTemplateRJC.afterPropertiesSet();

    RedisTemplate<String, Person> xstreamStringTemplateRJC = new RedisTemplate<String, Person>();
View Full Code Here


  }

  @Override
  RedisMap<Object, Object> createMap() {
    String redisName = getClass().getSimpleName();
    props = new RedisProperties(defaults, redisName, new StringRedisTemplate(template.getConnectionFactory()));
    return props;
  }
View Full Code Here

    jedisConnFactory.setPort(SettingsUtils.getPort());
    jedisConnFactory.setHostName(SettingsUtils.getHost());

    jedisConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> genericTemplate = new StringRedisTemplate(jedisConnFactory);

    RedisTemplate<String, String> xstreamGenericTemplate = new RedisTemplate<String, String>();
    xstreamGenericTemplate.setConnectionFactory(jedisConnFactory);
    xstreamGenericTemplate.setDefaultSerializer(serializer);
    xstreamGenericTemplate.afterPropertiesSet();

    RedisTemplate<String, Person> jsonPersonTemplate = new RedisTemplate<String, Person>();
    jsonPersonTemplate.setConnectionFactory(jedisConnFactory);
    jsonPersonTemplate.setDefaultSerializer(jsonSerializer);
    jsonPersonTemplate.setHashKeySerializer(jsonSerializer);
    jsonPersonTemplate.setHashValueSerializer(jsonStringSerializer);
    jsonPersonTemplate.afterPropertiesSet();

    // JRedis
    JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory();
    jredisConnFactory.setUsePool(true);
    jredisConnFactory.setPort(SettingsUtils.getPort());
    jredisConnFactory.setHostName(SettingsUtils.getHost());
    jredisConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> genericTemplateJR = new StringRedisTemplate(jredisConnFactory);
    RedisTemplate<String, Person> xGenericTemplateJR = new RedisTemplate<String, Person>();
    xGenericTemplateJR.setConnectionFactory(jredisConnFactory);
    xGenericTemplateJR.setDefaultSerializer(serializer);
    xGenericTemplateJR.afterPropertiesSet();

    RedisTemplate<String, Person> jsonPersonTemplateJR = new RedisTemplate<String, Person>();
    jsonPersonTemplateJR.setConnectionFactory(jredisConnFactory);
    jsonPersonTemplateJR.setDefaultSerializer(jsonSerializer);
    jsonPersonTemplateJR.setHashKeySerializer(jsonSerializer);
    jsonPersonTemplateJR.setHashValueSerializer(jsonStringSerializer);
    jsonPersonTemplateJR.afterPropertiesSet();

    // RJC

    // rjc
    RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory();
    rjcConnFactory.setUsePool(true);
    rjcConnFactory.setPort(SettingsUtils.getPort());
    rjcConnFactory.setHostName(SettingsUtils.getHost());
    rjcConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> genericTemplateRJC = new StringRedisTemplate(jredisConnFactory);
    RedisTemplate<String, Person> xGenericTemplateRJC = new RedisTemplate<String, Person>();
    xGenericTemplateRJC.setConnectionFactory(rjcConnFactory);
    xGenericTemplateRJC.setDefaultSerializer(serializer);
    xGenericTemplateRJC.afterPropertiesSet();
View Full Code Here

    jredisConnFactory.setUsePool(true);
    jredisConnFactory.setPort(SettingsUtils.getPort());
    jredisConnFactory.setHostName(SettingsUtils.getHost());
    jredisConnFactory.afterPropertiesSet();

    StringRedisTemplate templateJS = new StringRedisTemplate(jedisConnFactory);
    StringRedisTemplate templateJR = new StringRedisTemplate(jredisConnFactory);

    StringObjectFactory sof = new StringObjectFactory();

    DefaultRedisMap mapJS = new DefaultRedisMap("bound:key:map", templateJS);
View Full Code Here

    jedisConnFactory.setHostName(SettingsUtils.getHost());
    jedisConnFactory.setDatabase(2);

    jedisConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> stringTemplate = new StringRedisTemplate(jedisConnFactory);
    RedisTemplate<String, Person> personTemplate = new RedisTemplate<String, Person>();
    personTemplate.setConnectionFactory(jedisConnFactory);
    personTemplate.afterPropertiesSet();

    // create RJC

    RjcConnectionFactory rjcConnFactory = new RjcConnectionFactory();
    rjcConnFactory.setUsePool(false);
    rjcConnFactory.setPort(SettingsUtils.getPort());
    rjcConnFactory.setHostName(SettingsUtils.getHost());
    rjcConnFactory.afterPropertiesSet();

    RedisTemplate<String, String> stringTemplateRJC = new StringRedisTemplate(rjcConnFactory);
    RedisTemplate<String, Person> personTemplateRJC = new RedisTemplate<String, Person>();
    personTemplateRJC.setConnectionFactory(rjcConnFactory);
    personTemplateRJC.afterPropertiesSet();

View Full Code Here

  private final StringRedisTemplate redisTemplate;

  @Autowired
  private RedisHashPersonRepository(RedisConnectionFactory connectionFactory) {
    Assert.notNull(connectionFactory, "RedisConnectionFactory is required");
    this.redisTemplate = new StringRedisTemplate();
    this.redisTemplate.setConnectionFactory(connectionFactory);
  }
View Full Code Here

    //Thread.sleep(TimeUnit.SECONDS.toMillis(1));
  }

  @Test
  public void testWithMessages() throws Exception {
    StringRedisTemplate template = ctx.getBean(StringRedisTemplate.class);
    template.convertAndSend("x1", "[X]test");
    template.convertAndSend("z1", "[Z]test");
    //Thread.sleep(TimeUnit.SECONDS.toMillis(5));
  }
View Full Code Here

  @Test
  public void testErrorHandler() throws Exception {
    StubErrorHandler handler = ctx.getBean(StubErrorHandler.class);
   
    int index = handler.throwables.size();
    StringRedisTemplate template = ctx.getBean(StringRedisTemplate.class);
    template.convertAndSend("exception", "test1");
    handler.throwables.pollLast(3, TimeUnit.SECONDS);
    assertEquals(index + 1, handler.throwables.size());
  }
View Full Code Here

    List<String> mGet = connection.mGet(keys);
    assertEquals(2, mGet.size());
    assertNull(mGet.get(0));
    assertNull(mGet.get(1));

    StringRedisTemplate stringTemplate = new StringRedisTemplate(getConnectionFactory());
    List<String> multiGet = stringTemplate.opsForValue().multiGet(Arrays.asList(keys));
    assertEquals(2, multiGet.size());
    assertNull(multiGet.get(0));
    assertNull(multiGet.get(1));
  }
View Full Code Here

    jedisConnFactory.setPort(SettingsUtils.getPort());
    jedisConnFactory.setHostName(SettingsUtils.getHost());

    jedisConnFactory.afterPropertiesSet();

    this.template = new StringRedisTemplate(jedisConnFactory);
    ConnectionFactoryTracker.add(jedisConnFactory);
  }
View Full Code Here

TOP

Related Classes of org.springframework.data.keyvalue.redis.core.StringRedisTemplate

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.