Java 类org.springframework.data.redis.core.RedisTemplate 实例源码

项目:springboot_cwenao    文件:RedisConfig.java   
@Bean(name="redisTemplate")
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory) {

    RedisTemplate<String, String> template = new RedisTemplate<>();


    RedisSerializer<String> redisSerializer = new StringRedisSerializer();

    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
    ObjectMapper om = new ObjectMapper();
    om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    jackson2JsonRedisSerializer.setObjectMapper(om);

    template.setConnectionFactory(factory);
    //key序列化方式
    template.setKeySerializer(redisSerializer);
    //value序列化
    template.setValueSerializer(jackson2JsonRedisSerializer);
    //value hashmap序列化
    template.setHashValueSerializer(jackson2JsonRedisSerializer);

    return template;
}
项目:springboot_cwenao    文件:RedisConfig.java   
@Bean(name="redisTemplate")
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory) {

    RedisTemplate<String, String> template = new RedisTemplate<>();


    RedisSerializer<String> redisSerializer = new StringRedisSerializer();

    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
    ObjectMapper om = new ObjectMapper();
    om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    jackson2JsonRedisSerializer.setObjectMapper(om);

    template.setConnectionFactory(factory);
    //key序列化方式
    template.setKeySerializer(redisSerializer);
    //value序列化
    template.setValueSerializer(jackson2JsonRedisSerializer);
    //value hashmap序列化
    template.setHashValueSerializer(jackson2JsonRedisSerializer);

    return template;
}
项目:springboot_op    文件:RedisConfiguration.java   
/**
 * RedisTemplate配置
 * @param factory
 * @return
 */
@Bean
@SuppressWarnings({"rawtypes", "unchecked"})
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory) {
    StringRedisTemplate template = new StringRedisTemplate(factory);
    //定义value的序列化方式
    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
    ObjectMapper om = new ObjectMapper();
    om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    jackson2JsonRedisSerializer.setObjectMapper(om);

    template.setValueSerializer(jackson2JsonRedisSerializer);
    template.setHashValueSerializer(jackson2JsonRedisSerializer);
    template.afterPropertiesSet();
    return template;
}
项目:JavaQuarkBBS    文件:RedisConfig.java   
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
    RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
    //设置缓存过期时间
    //rcm.setDefaultExpiration(60);//秒
    return rcm;
}
项目:springboot-smart    文件:RedisConfiguration.java   
@Bean("redisTemplate")  //新家的这个注解 10-26 12:06
@SuppressWarnings({ "rawtypes", "unchecked" })
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory redisFactory){
    StringRedisTemplate template = new StringRedisTemplate(redisFactory);
    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new 
            Jackson2JsonRedisSerializer(Object.class);

    ObjectMapper om = new ObjectMapper();
    om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    jackson2JsonRedisSerializer.setObjectMapper(om);

    template.setValueSerializer(jackson2JsonRedisSerializer);
    template.afterPropertiesSet();
    return template;
}
项目:action    文件:RedisUtil.java   
@Bean
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
    RedisTemplate<Object, Object> template = new RedisTemplate<>();
    template.setConnectionFactory(connectionFactory);

    //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值
    Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(Object.class);

    ObjectMapper mapper = new ObjectMapper();
    mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    serializer.setObjectMapper(mapper);

    template.setValueSerializer(serializer);
    //使用StringRedisSerializer来序列化和反序列化redis的key值
    template.setKeySerializer(new StringRedisSerializer());
    template.afterPropertiesSet();
    return template;
}
项目:keti    文件:AttributeCacheFactory.java   
private AttributeCache createAttributeCache(final String cacheType, final long maxCachedIntervalMinutes,
        final String zoneName, final RedisTemplate<String, String> cacheRedisTemplate,
        final BiFunction<String, String, String> getKey, final boolean enableAttributeCaching) {
    String[] profiles = environment.getActiveProfiles();

    if (!enableAttributeCaching) {
        LOGGER.info("Caching disabled for {} attributes.", cacheType);
        return new NonCachingAttributeCache();
    }
    if (ArrayUtils.contains(profiles, "redis") || ArrayUtils.contains(profiles, "cloud-redis")) {
        LOGGER.info("Redis caching enabled for {} attributes.", cacheType);
        return new RedisAttributeCache(maxCachedIntervalMinutes, zoneName, getKey, cacheRedisTemplate);
    }
    LOGGER.info("In-memory caching enabled for {} attributes.", cacheType);
    return new InMemoryAttributeCache(maxCachedIntervalMinutes, zoneName, getKey);
}
项目:storm_spring_boot_demo    文件:RedisConfUtils.java   
public static RedisTemplate buildRedisTemplate(byte[] redisProperties){
    JedisConnectionFactory jedisConnectionFactory = new JedisConnectionFactory(
            RedisConfUtils.getClusterConfiguration(
                    (RedisProperties) Serializer.INSTANCE.deserialize(redisProperties)));
    RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(jedisConnectionFactory);
    jedisConnectionFactory.afterPropertiesSet();

    GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
    StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
    redisTemplate.setKeySerializer(stringRedisSerializer);
    redisTemplate.setValueSerializer(genericJackson2JsonRedisSerializer);
    redisTemplate.setHashKeySerializer(stringRedisSerializer);
    redisTemplate.setHashValueSerializer(genericJackson2JsonRedisSerializer);
    redisTemplate.afterPropertiesSet();
    return redisTemplate;
}
项目:ait-platform    文件:AitCacheConfigBase.java   
@Bean
@Primary
RedisTemplate<String, Object> redisTemplate(RedisConnectionFactory rcf) {
    AitLogger.debug(logger, "Serializer overriding ");

    RedisTemplate<String, Object> template = new RedisTemplate<>();
    template.setConnectionFactory(rcf);

    GenericJackson2JsonRedisSerializer valSerializer = new GenericJackson2JsonRedisSerializer();

    template.setValueSerializer(valSerializer);
    template.setKeySerializer(new RedisSerializer<Object>() {

        @Override
        public byte[] serialize(Object t) throws SerializationException {
            return (t == null ? null : (":" + t.toString()).getBytes());
        }

        @Override
        public Object deserialize(byte[] bytes) throws SerializationException {
            return (bytes == null ? null : new String(bytes));
        }
    });
    template.setHashValueSerializer(valSerializer);
    return template;
}
项目:data-migration    文件:RedisConfiguration.java   
@Bean
public RedisTemplate<Object, Object> redisTemplate(RedisConnectionFactory connectionFactory) {
    RedisTemplate<Object, Object> template = new RedisTemplate<>();
    template.setConnectionFactory(connectionFactory);

    //使用Jackson2JsonRedisSerializer来序列化和反序列化redis的value值
    Jackson2JsonRedisSerializer serializer = new Jackson2JsonRedisSerializer(Object.class);

    ObjectMapper mapper = new ObjectMapper();
    mapper.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    mapper.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    serializer.setObjectMapper(mapper);

    template.setValueSerializer(serializer);
    //使用StringRedisSerializer来序列化和反序列化redis的key值
    template.setKeySerializer(new StringRedisSerializer());
    template.afterPropertiesSet();
    return template;
}
项目:happylifeplat-transaction    文件:RedisClusterConfig.java   
@Bean
public RedisTemplate getStringRedisTemplate() {
    StringRedisTemplate clusterTemplate = new StringRedisTemplate();
    clusterTemplate.setConnectionFactory(jedisConnectionFactory());
    clusterTemplate.setKeySerializer(new StringRedisSerializer());
    clusterTemplate.setValueSerializer(new GenericJackson2JsonRedisSerializer());
    return clusterTemplate;
}
项目:JavaStudy    文件:Test.java   
@org.junit.Test
public void test(){
    String  user_prefix="user_";
    User user=new User(1,"aric");
    ApplicationContext atc=new AnnotationConfigApplicationContext(RedisStartConfig.class);
    RedisTemplate<String,User> obj = (RedisTemplate) atc.getBean("redisTemplate");
    PrinterUtils.printILog(obj.getKeySerializer());
    obj.opsForValue().set(user_prefix+user.getId(),user);
    RedisSentinelConfiguration RedisSentinelConfiguration = (RedisSentinelConfiguration) atc.getBean("sentinelConfig");
    PrinterUtils.printILog(RedisSentinelConfiguration);
    User value=obj.opsForValue().get(user_prefix+1);
    PrinterUtils.printELog(value.getUsername());
}
项目:springboot-shiro-cas-mybatis    文件:RedisConfig.java   
@SuppressWarnings({"unchecked","rawtypes"})
@Bean  
   public RedisTemplate<String, String> redisTemplate(  
           RedisConnectionFactory factory) {  
       StringRedisTemplate template = new StringRedisTemplate(factory);  
    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);  
       ObjectMapper om = new ObjectMapper();  
       om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);  
       om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);  
       jackson2JsonRedisSerializer.setObjectMapper(om);  
       template.setValueSerializer(jackson2JsonRedisSerializer);  
       template.afterPropertiesSet();  
       return template;  
   }
项目:springboot-shiro-cas-mybatis    文件:RedisConfig.java   
@SuppressWarnings({"unchecked","rawtypes"})
@Bean  
   public RedisTemplate<String, String> redisTemplate(  
           RedisConnectionFactory factory) {  
       StringRedisTemplate template = new StringRedisTemplate(factory);  
    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);  
       ObjectMapper om = new ObjectMapper();  
       om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);  
       om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);  
       jackson2JsonRedisSerializer.setObjectMapper(om);  
       template.setValueSerializer(jackson2JsonRedisSerializer);  
       template.afterPropertiesSet();  
       return template;  
   }
项目:parrot-rest    文件:ApplicationTestConfiguration.java   
@Bean
public RedisTemplate<String, Phrase> redisTemplate() {
    @SuppressWarnings("unchecked")
    RedisTemplate<String, Phrase> template = mock(RedisTemplate.class);
    opsHash = new HashOperationsMock();
    when(template.opsForHash()).thenReturn(opsHash);
    return template;
}
项目:JavaQuarkBBS    文件:RedisConfig.java   
@Bean
public RedisTemplate<String, String> redisTemplate(RedisConnectionFactory factory) {
    StringRedisTemplate template = new StringRedisTemplate(factory);
    Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
    ObjectMapper om = new ObjectMapper();
    om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
    om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
    jackson2JsonRedisSerializer.setObjectMapper(om);
    template.setValueSerializer(jackson2JsonRedisSerializer);
    template.afterPropertiesSet();
    return template;
}
项目:JavaQuarkBBS    文件:RedisConfig.java   
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate) {
    RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
    //设置缓存过期时间
    //rcm.setDefaultExpiration(60);//秒
    return rcm;
}
项目:lemcloud    文件:RedisConfig.java   
@SuppressWarnings({ "unchecked", "rawtypes" })
  private void setSerializer(RedisTemplate<String, Object> template) {
Jackson2JsonRedisSerializer jackson2JsonRedisSerializer = new Jackson2JsonRedisSerializer(Object.class);
      ObjectMapper om = new ObjectMapper();
      om.setVisibility(PropertyAccessor.ALL, JsonAutoDetect.Visibility.ANY);
      om.enableDefaultTyping(ObjectMapper.DefaultTyping.NON_FINAL);
      jackson2JsonRedisSerializer.setObjectMapper(om);
      template.setKeySerializer(new StringRedisSerializer());
      //template.setValueSerializer(jackson2JsonRedisSerializer);       //-- 值序列化为json
      template.setValueSerializer(new RedisObjectSerializer());       //-- 默认序列化为byte[]
  }
项目:iBase4J-Common    文件:RedisHelper.java   
@SuppressWarnings("unchecked")
public void setRedisTemplate(RedisTemplate<Serializable, Serializable> redisTemplate) {
    this.redisTemplate = redisTemplate;
    this.keySerializer = (RedisSerializer<String>)redisTemplate.getKeySerializer();
    this.valueSerializer = (RedisSerializer<Object>)redisTemplate.getValueSerializer();
    CacheUtil.setCacheManager(this);
}
项目:iBase4J-Common    文件:JedisConfig.java   
@Bean
@Qualifier("redisTemplate")
public CacheManager redisCacheManager(RedisTemplate<Serializable, Serializable> redisTemplate) {
    RedisCacheManager cacheManager = new RedisCacheManager(redisTemplate);
    cacheManager.setTransactionAware(true);
    cacheManager.setDefaultExpiration(PropertiesUtil.getInt("redis.expiration", 10));
    return cacheManager;
}
项目:neto    文件:AppConfig.java   
private RedisTemplate jsonRedisTemplate(JedisConnectionFactory jedisConnectionFactory, Class<?> clazz) {
    RedisTemplate template = new RedisTemplate();
    template.setKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new Jackson2JsonRedisSerializer(clazz));
    template.setHashKeySerializer(new StringRedisSerializer());
    template.setHashValueSerializer(new Jackson2JsonRedisSerializer(clazz));
    template.setConnectionFactory(jedisConnectionFactory);
    return template;
}
项目:tx-lcn    文件:JedisClusterConfig.java   
@Bean
public RedisTemplate redisTemplateFactory(){
    RedisTemplate redisTemplate =new RedisTemplate();
    redisTemplate.setConnectionFactory(jedisConnectionFactory());

    //指定具体序列化方式  不过这种方式不是很好,一个系统中可能对应值的类型不一样,如果全部使用StringRedisSerializer 序列化
    //会照成其他类型报错,所以还是推荐使用第一种,直接指定泛型的类型,spring 会根据指定类型序列化。
    //redisTemplate.setKeySerializer( new StringRedisSerializer());
    //redisTemplate.setValueSerializer(new StringRedisSerializer());
    //redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    //redisTemplate.setHashValueSerializer(new StringRedisSerializer());
    return redisTemplate;
}
项目:xproject    文件:RedisCache.java   
public RedisCache(String cacheName, RedisTemplate<String, Object> redisTemplate, boolean cacheExpire,
        int cacheExpireSeconds, String cacheKeyPrefix) {
    super();
    Assert.hasText(cacheName, "Parameter 'cacheName' can not be empty!");
    Assert.notNull(redisTemplate, "Parameter 'redisTemplate' can not be null!");
    Assert.isTrue(cacheExpireSeconds > 0, "Parameter 'cacheExpireSeconds' must be > 0!");
    this.cacheName = cacheName;
    this.redisTemplate = redisTemplate;
    this.cacheExpire = cacheExpire;
    this.cacheExpireSeconds = cacheExpireSeconds;
    this.cacheKeyPrefix = cacheKeyPrefix;
}
项目:automat    文件:RedisHelper.java   
@SuppressWarnings("unchecked")
private RedisTemplate<Serializable, Serializable> getRedis() {
    if (redisTemplate == null) {
        synchronized (RedisHelper.class) {
            if (redisTemplate == null) {
                redisTemplate = (RedisTemplate<Serializable, Serializable>)applicationContext
                        .getBean("redisTemplate");
            }
        }
    }
    return redisTemplate;
}
项目:spring-data-examples    文件:ApplicationConfiguration.java   
@Bean
RedisTemplate<?, ?> redisTemplate(RedisConnectionFactory connectionFactory) {

    RedisTemplate<byte[], byte[]> template = new RedisTemplate<byte[], byte[]>();
    template.setConnectionFactory(connectionFactory);

    return template;
}
项目:filter    文件:JedisClusterConfig.java   
@Bean
    public RedisTemplate redisTemplateFactory(){
        RedisTemplate redisTemplate =new RedisTemplate();
        redisTemplate.setConnectionFactory(jedisConnectionFactory());

        //指定具体序列化方式  不过这种方式不是很好,一个系统中可能对应值的类型不一样,如果全部使用StringRedisSerializer 序列化
        //会照成其他类型报错,所以还是推荐使用第一种,直接指定泛型的类型,spring 会根据指定类型序列化。
//        redisTemplate.setKeySerializer( new StringRedisSerializer());
//        redisTemplate.setValueSerializer(new StringRedisSerializer());
//        redisTemplate.setHashKeySerializer(new StringRedisSerializer());
//        redisTemplate.setHashValueSerializer(new StringRedisSerializer());
        return redisTemplate;
    }
项目:OutsourcedProject    文件:RedisConfig.java   
@Bean
public <K, V> RedisTemplate<K, V> redisTemplate(RedisConnectionFactory redisConnectionFactory) {
    RedisTemplate<K, V> template = new RedisTemplate<>();
    template.setConnectionFactory(redisConnectionFactory);
    template.setKeySerializer(new StringRedisSerializer());
    template.setHashKeySerializer(new StringRedisSerializer());
    template.setValueSerializer(new GenericJackson2JsonRedisSerializer());
    template.setHashValueSerializer(new GenericJackson2JsonRedisSerializer());
    template.setEnableTransactionSupport(true);
    template.afterPropertiesSet();
    return template;
}
项目:MI-S    文件:RedisConfig.java   
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate){
    RedisCacheManager rcm = new RedisCacheManager(redisTemplate);
    //设置缓存过期时间
    //rcm.setDefaultExpiration(60);//秒
    return rcm;
}
项目:boot-mon    文件:BootmonServerRedisConfig.java   
@Bean
public RedisTemplate<String, Object> redisTemplate() {
    final RedisTemplate<String, Object> template = new RedisTemplate<String, Object>();
    template.setConnectionFactory(jedisConnectionFactory());
    template.setValueSerializer(new GenericToStringSerializer<Object>(Object.class));
    return template;
}
项目:bird-java    文件:RedisCacher.java   
@SuppressWarnings("unchecked")
private RedisTemplate<Serializable, Serializable> getRedis() {
    if (redisTemplate == null) {
        synchronized (RedisCacher.class) {
            if (redisTemplate == null) {
                redisTemplate = (RedisTemplate<Serializable, Serializable>)applicationContext
                        .getBean("redisTemplate");
            }
        }
    }
    return redisTemplate;
}
项目:shoucang    文件:RedisConfiguration.java   
@Bean(name = "redisListTemplate")
RedisTemplate<String, Long> redisListTemplate() {
    RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(jedisConnectionFactory());
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Long.class));
    return redisTemplate;
}
项目:shoucang    文件:RedisConfiguration.java   
@Bean(name = "redisCountingTemplate")
RedisTemplate<String, Integer> redisCountingTemplate() {
    RedisTemplate<String, Integer> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(jedisConnectionFactory());
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashValueSerializer(new GenericToStringSerializer<>(Integer.class));
    return redisTemplate;
}
项目:raven    文件:CacheService.java   
/** 查询huawei accessToken */
public AccessToken getHuaweiAK()
{
    Cache redisCache1101 = commonCacheManager.getCache("redisCache1101");
    @SuppressWarnings("unchecked")
    RedisTemplate<String, AccessToken> template = (RedisTemplate<String, AccessToken>)redisCache1101.getNativeCache();
    Set<String> keys = template.keys(CacheKeyPrefixConst.HW_ACCESS_TOKEN);

    if (null == keys || keys.isEmpty())
    {
        return null;
    }

    return redisCache1101.get(keys.iterator().next(), AccessToken.class);
}
项目:DanmuChat    文件:RedisConfig.java   
@SuppressWarnings("rawtypes")
@Bean
public CacheManager cacheManager(RedisTemplate redisTemplate){
    RedisCacheManager redisCacheManager =new RedisCacheManager(redisTemplate);
    //设置缓存过期时间
    redisCacheManager.setDefaultExpiration(60);//秒
    return redisCacheManager;
}
项目:DanmuChat    文件:RedisConfig.java   
/**
 * 序列化设置
 */
private void initRedisTemplate(RedisTemplate<String, String> redisTemplate, RedisConnectionFactory factory) {
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashKeySerializer(new StringRedisSerializer());
    redisTemplate.setHashValueSerializer(new JdkSerializationRedisSerializer());
    redisTemplate.setValueSerializer(new JdkSerializationRedisSerializer());
    redisTemplate.setConnectionFactory(factory);
}
项目:spring-boot-start-current    文件:SpringCacheConfig.java   
@Bean
public CacheManager cacheManager ( RedisTemplate redisTemplate ) {
    RedisCacheManager redisCacheManager = new RedisCacheManager( redisTemplate );
    // 默认30分钟
    redisCacheManager.setDefaultExpiration( defaultExpiration );
    redisCacheManager.setExpires( expires );
    redisCacheManager.setUsePrefix( usePrefix );
    return redisCacheManager;
}
项目:keti    文件:RedisAttributeCache.java   
RedisAttributeCache(final long maxCachedIntervalMinutes, final String zoneName,
        final BiFunction<String, String, String> getKey,
        final RedisTemplate<String, String> resourceCacheRedisTemplate) {
    this.maxCachedIntervalMinutes = maxCachedIntervalMinutes;
    this.zoneName = zoneName;
    this.getKey = getKey;
    this.resourceCacheRedisTemplate = resourceCacheRedisTemplate;
}
项目:keti    文件:CommonRedisConfig.java   
private RedisTemplate<String, String> createCacheRedisTemplate(final RedisConnectionFactory redisConnectionFactory,
        final String redisTemplateType) {
    RedisTemplate<String, String> redisTemplate = new RedisTemplate<>();
    redisTemplate.setConnectionFactory(redisConnectionFactory);
    redisTemplate.setDefaultSerializer(new StringRedisSerializer());
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    redisTemplate.setValueSerializer(new StringRedisSerializer());
    LOGGER.info("Successfully created {} Redis template.", redisTemplateType);
    return redisTemplate;
}
项目:storm_spring_boot_demo    文件:RedisConfig.java   
@Bean("redisTemplate")
public RedisTemplate<?, ?> getRedisTemplate(){
    RedisTemplate<?,?> template = new StringRedisTemplate(jedisConnectionFactory);
    GenericJackson2JsonRedisSerializer genericJackson2JsonRedisSerializer = new GenericJackson2JsonRedisSerializer();
    StringRedisSerializer stringRedisSerializer = new StringRedisSerializer();
    template.setKeySerializer(stringRedisSerializer);
    template.setValueSerializer(genericJackson2JsonRedisSerializer);
    template.setHashKeySerializer(stringRedisSerializer);
    template.setHashValueSerializer(genericJackson2JsonRedisSerializer);
    return template;
}
项目:xq_seckill_microservice    文件:CachingConfig.java   
@Bean
public RedisTemplate byteRedisTemplate(RedisConnectionFactory redisConnectionFactory) {
    RedisTemplate redisTemplate = new RedisTemplate();
    redisTemplate.setConnectionFactory(redisConnectionFactory);
    redisTemplate.setEnableDefaultSerializer(true);
    //redisTemplate.setDefaultSerializer(new StringRedisSerializer());
    redisTemplate.setKeySerializer(new StringRedisSerializer());
    //redisTemplate.setValueSerializer(new StringRedisSerializer());
    //redisTemplate.setEnableTransactionSupport(true);
    redisTemplate.afterPropertiesSet();
    return redisTemplate;
}