org.springframework.data.redis.core.RedisTemplate.setExposeConnection()方法的使用及代码示例

x33g5p2x  于2022-01-28 转载在 其他  
字(7.8k)|赞(0)|评价(0)|浏览(168)

本文整理了Java中org.springframework.data.redis.core.RedisTemplate.setExposeConnection方法的一些代码示例,展示了RedisTemplate.setExposeConnection的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。RedisTemplate.setExposeConnection方法的具体详情如下:
包路径:org.springframework.data.redis.core.RedisTemplate
类名称:RedisTemplate
方法名:setExposeConnection

RedisTemplate.setExposeConnection介绍

[英]Sets whether to expose the Redis connection to RedisCallback code. Default is "false": a proxy will be returned, suppressing quit and disconnect calls.
[中]设置是否向Redis回调代码公开Redis连接。默认值为“false”:将返回一个代理,禁止退出和断开呼叫。

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

private RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory, @Nullable Double initialValue) {
  Assert.hasText(redisCounter, "a valid counter name is required");
  Assert.notNull(factory, "a valid factory is required");
  RedisTemplate<String, Double> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Double.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: spring-projects/spring-data-redis

private RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, @Nullable Long initialValue) {
  Assert.hasText(redisCounter, "a valid counter name is required");
  Assert.notNull(factory, "a valid factory is required");
  RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Long.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: spring-projects/spring-data-redis

private RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory, @Nullable Integer initialValue) {
  RedisTemplate<String, Integer> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Integer.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-redis

private RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory, @Nullable Double initialValue) {
  Assert.hasText(redisCounter, "a valid counter name is required");
  Assert.notNull(factory, "a valid factory is required");
  RedisTemplate<String, Double> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Double.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: org.springframework.data/spring-data-redis

private RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, @Nullable Long initialValue) {
  Assert.hasText(redisCounter, "a valid counter name is required");
  Assert.notNull(factory, "a valid factory is required");
  RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Long.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: apache/servicemix-bundles

private RedisAtomicDouble(String redisCounter, RedisConnectionFactory factory, @Nullable Double initialValue) {
  Assert.hasText(redisCounter, "a valid counter name is required");
  Assert.notNull(factory, "a valid factory is required");
  RedisTemplate<String, Double> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Double.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: apache/servicemix-bundles

private RedisAtomicLong(String redisCounter, RedisConnectionFactory factory, @Nullable Long initialValue) {
  Assert.hasText(redisCounter, "a valid counter name is required");
  Assert.notNull(factory, "a valid factory is required");
  RedisTemplate<String, Long> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Long.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: org.springframework.analytics/spring-analytics

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);
  redisTemplate.setConnectionFactory(connectionFactory);
  redisTemplate.afterPropertiesSet();
  return redisTemplate;
}

代码示例来源:origin: org.springframework.data/spring-data-redis

private RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory, @Nullable Integer initialValue) {
  RedisTemplate<String, Integer> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Integer.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

代码示例来源:origin: apache/servicemix-bundles

private RedisAtomicInteger(String redisCounter, RedisConnectionFactory factory, @Nullable Integer initialValue) {
  RedisTemplate<String, Integer> redisTemplate = new RedisTemplate<>();
  redisTemplate.setKeySerializer(RedisSerializer.string());
  redisTemplate.setValueSerializer(new GenericToStringSerializer<>(Integer.class));
  redisTemplate.setExposeConnection(true);
  redisTemplate.setConnectionFactory(factory);
  redisTemplate.afterPropertiesSet();
  this.key = redisCounter;
  this.generalOps = redisTemplate;
  this.operations = generalOps.opsForValue();
  if (initialValue == null) {
    initializeIfAbsent();
  } else {
    set(initialValue);
  }
}

相关文章

微信公众号

最新文章

更多