Package org.springframework.data.keyvalue.redis.connection

Examples of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory


   * @return object returned by the action
   */
  public <T> T execute(RedisCallback<T> action, boolean exposeConnection, boolean pipeline) {
    Assert.notNull(action, "Callback object must not be null");

    RedisConnectionFactory factory = getConnectionFactory();
    RedisConnection conn = RedisConnectionUtils.getConnection(factory);

    boolean existingConnection = TransactionSynchronizationManager.hasResource(factory);
    preProcessConnection(conn, existingConnection);

View Full Code Here


  }


  @Override
  public <T> T execute(SessionCallback<T> session) {
    RedisConnectionFactory factory = getConnectionFactory();
    // bind connection
    RedisConnectionUtils.bindConnection(factory);
    try {
      return session.execute(this);
    } finally {
View Full Code Here

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("config.xml", RedisHashDemo.class);
   
    // clear out old test data first
    RedisConnectionFactory connectionFactory = context.getBean(RedisConnectionFactory.class);
    RedisTemplate<String, String> redisTemplate = new RedisTemplate<String, String>(connectionFactory);
    Set<String> keys = redisTemplate.keys(RedisHashPersonRepository.REDIS_KEY_PATTERN);
    if (keys != null && keys.size() > 0) {
      redisTemplate.delete(keys);
    }
View Full Code Here

  public static void main(String[] args) {
    ApplicationContext context = new ClassPathXmlApplicationContext("config.xml", RedisSetDemo.class);
   
    // clear out old test data first
    RedisConnectionFactory connectionFactory = context.getBean(RedisConnectionFactory.class);
    new RedisTemplate<String, Person>(connectionFactory)
        .delete(Collections.singletonList(RedisSetPersonRepository.REDIS_KEY));
   
    PersonRepository personRepository = context.getBean(RedisSetPersonRepository.class);
   
View Full Code Here

public class SessionTest {

  @Test
  public void testSession() throws Exception {
    final RedisConnection conn = mock(RedisConnection.class);
    RedisConnectionFactory factory = mock(RedisConnectionFactory.class);

    when(factory.getConnection()).thenReturn(conn);
    final StringRedisTemplate template = new StringRedisTemplate(factory);

    template.execute(new SessionCallback<Object>() {
      @Override
      public Object execute(RedisOperations operations) {
View Full Code Here

TOP

Related Classes of org.springframework.data.keyvalue.redis.connection.RedisConnectionFactory

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.