Package org.springframework.data.redis.core

Examples of org.springframework.data.redis.core.RedisTemplate


      RedisConnection connectionMock = mock(RedisConnection.class);
      RedisConnectionFactory factoryMock = mock(RedisConnectionFactory.class);

      when(factoryMock.getConnection()).thenReturn(connectionMock);

      RedisTemplate template = new RedisTemplate();
      template.setConnectionFactory(factoryMock);

      return template;
    }
View Full Code Here


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

    RedisTemplate genericTemplate = new RedisTemplate();
    genericTemplate.setConnectionFactory(jedisConnFactory);
    genericTemplate.afterPropertiesSet();

    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();

    RedisTemplate<String, Person> jackson2JsonPersonTemplate = new RedisTemplate<String, Person>();
    jackson2JsonPersonTemplate.setConnectionFactory(jedisConnFactory);
    jackson2JsonPersonTemplate.setDefaultSerializer(jackson2JsonSerializer);
    jackson2JsonPersonTemplate.setHashKeySerializer(jackson2JsonSerializer);
    jackson2JsonPersonTemplate.setHashValueSerializer(jackson2JsonStringSerializer);
    jackson2JsonPersonTemplate.afterPropertiesSet();

    RedisTemplate<String, byte[]> rawTemplate = new RedisTemplate<String, byte[]>();
    rawTemplate.setEnableDefaultSerializer(false);
    rawTemplate.setConnectionFactory(jedisConnFactory);
    rawTemplate.setKeySerializer(stringSerializer);
    rawTemplate.afterPropertiesSet();

    // JRedis
    JredisConnectionFactory jredisConnFactory = new JredisConnectionFactory(new JredisPool(SettingsUtils.getHost(),
        SettingsUtils.getPort(), defaultPoolConfig));
    jredisConnFactory.afterPropertiesSet();

    RedisTemplate genericTemplateJR = new RedisTemplate();
    genericTemplateJR.setConnectionFactory(jredisConnFactory);
    genericTemplateJR.afterPropertiesSet();

    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();

    RedisTemplate<String, Person> jackson2JsonPersonTemplateJR = new RedisTemplate<String, Person>();
    jackson2JsonPersonTemplateJR.setConnectionFactory(jredisConnFactory);
    jackson2JsonPersonTemplateJR.setDefaultSerializer(jackson2JsonSerializer);
    jackson2JsonPersonTemplateJR.setHashKeySerializer(jackson2JsonSerializer);
    jackson2JsonPersonTemplateJR.setHashValueSerializer(jackson2JsonStringSerializer);
    jackson2JsonPersonTemplateJR.afterPropertiesSet();

    RedisTemplate<String, byte[]> rawTemplateJR = new RedisTemplate<String, byte[]>();
    rawTemplateJR.setEnableDefaultSerializer(false);
    rawTemplateJR.setConnectionFactory(jredisConnFactory);
    rawTemplateJR.setKeySerializer(stringSerializer);
    rawTemplateJR.afterPropertiesSet();

    // Lettuce
    LettuceConnectionFactory lettuceConnFactory = new LettuceConnectionFactory();
    lettuceConnFactory.setHostName(SettingsUtils.getHost());
    lettuceConnFactory.setPort(SettingsUtils.getPort());
    lettuceConnFactory.afterPropertiesSet();

    RedisTemplate genericTemplateLettuce = new RedisTemplate();
    genericTemplateLettuce.setConnectionFactory(lettuceConnFactory);
    genericTemplateLettuce.afterPropertiesSet();

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

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

    RedisTemplate<String, Person> jackson2JsonPersonTemplateLettuce = new RedisTemplate<String, Person>();
    jackson2JsonPersonTemplateLettuce.setConnectionFactory(lettuceConnFactory);
    jackson2JsonPersonTemplateLettuce.setDefaultSerializer(jackson2JsonSerializer);
    jackson2JsonPersonTemplateLettuce.setHashKeySerializer(jackson2JsonSerializer);
    jackson2JsonPersonTemplateLettuce.setHashValueSerializer(jackson2JsonStringSerializer);
    jackson2JsonPersonTemplateLettuce.afterPropertiesSet();

    RedisTemplate<String, String> stringTemplateLtc = new StringRedisTemplate();
    stringTemplateLtc.setConnectionFactory(lettuceConnFactory);
    stringTemplateLtc.afterPropertiesSet();

    RedisTemplate<String, byte[]> rawTemplateLtc = new RedisTemplate<String, byte[]>();
    rawTemplateLtc.setEnableDefaultSerializer(false);
    rawTemplateLtc.setConnectionFactory(lettuceConnFactory);
    rawTemplateLtc.setKeySerializer(stringSerializer);
    rawTemplateLtc.afterPropertiesSet();

    // SRP
    SrpConnectionFactory srpConnFactory = new SrpConnectionFactory();
    srpConnFactory.setPort(SettingsUtils.getPort());
    srpConnFactory.setHostName(SettingsUtils.getHost());
    srpConnFactory.afterPropertiesSet();

    RedisTemplate genericTemplateSrp = new RedisTemplate();
    genericTemplateSrp.setConnectionFactory(srpConnFactory);
    genericTemplateSrp.afterPropertiesSet();

    RedisTemplate<String, Person> xGenericTemplateSrp = new RedisTemplate<String, Person>();
    xGenericTemplateSrp.setConnectionFactory(srpConnFactory);
    xGenericTemplateSrp.setDefaultSerializer(serializer);
    xGenericTemplateSrp.afterPropertiesSet();
View Full Code Here

TOP

Related Classes of org.springframework.data.redis.core.RedisTemplate

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.