redis.clients.jedis.Jedis.getDB()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(2.6k)|赞(0)|评价(0)|浏览(241)

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

Jedis.getDB介绍

暂无

代码示例

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

/**
 * Constructs a new <code>JedisConnection</code> instance backed by a jedis pool.
 *
 * @param jedis
 * @param pool can be null, if no pool is used
 * @param dbIndex
 * @param clientName the client name, can be {@literal null}.
 * @since 1.8
 */
protected JedisConnection(Jedis jedis, @Nullable Pool<Jedis> pool, int dbIndex, String clientName) {
  this.jedis = jedis;
  this.pool = pool;
  this.dbIndex = dbIndex;
  this.clientName = clientName;
  // select the db
  // if this fail, do manual clean-up before propagating the exception
  // as we're inside the constructor
  if (dbIndex != jedis.getDB()) {
    try {
      select(dbIndex);
    } catch (DataAccessException ex) {
      close();
      throw ex;
    }
  }
}

代码示例来源:origin: io.leopard/leopard-redis

@Override
public Long getDB() {
  return jedis.getDB();
}

代码示例来源:origin: penggle/jedis-ms-sentinel

public Long getDB() {
  return master.getDB();
}

代码示例来源:origin: com.netflix.spinnaker.kork/kork-jedis

@Override
public Long getDB() {
 String command = "getDB";
 return instrumented(command, () -> delegated.getDB());
}

代码示例来源:origin: org.nutz/nutz-integration-jedis

public Long getDB() {
  Jedis jedis = getJedis();
  try {
    return jedis.getDB();
  } finally {Streams.safeClose(jedis);}
}

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

/**
 * Constructs a new <code>JedisConnection</code> instance backed by a jedis pool.
 *
 * @param jedis
 * @param pool can be null, if no pool is used
 * @param dbIndex
 * @param clientName the client name, can be {@literal null}.
 * @since 1.8
 */
protected JedisConnection(Jedis jedis, @Nullable Pool<Jedis> pool, int dbIndex, String clientName) {
  this.jedis = jedis;
  this.pool = pool;
  this.dbIndex = dbIndex;
  this.clientName = clientName;
  // select the db
  // if this fail, do manual clean-up before propagating the exception
  // as we're inside the constructor
  if (dbIndex != jedis.getDB()) {
    try {
      select(dbIndex);
    } catch (DataAccessException ex) {
      close();
      throw ex;
    }
  }
}

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

/**
 * Constructs a new <code>JedisConnection</code> instance backed by a jedis pool.
 *
 * @param jedis
 * @param pool can be null, if no pool is used
 * @param dbIndex
 * @param clientName the client name, can be {@literal null}.
 * @since 1.8
 */
protected JedisConnection(Jedis jedis, @Nullable Pool<Jedis> pool, int dbIndex, String clientName) {
  this.jedis = jedis;
  this.pool = pool;
  this.dbIndex = dbIndex;
  this.clientName = clientName;
  // select the db
  // if this fail, do manual clean-up before propagating the exception
  // as we're inside the constructor
  if (dbIndex != jedis.getDB()) {
    try {
      select(dbIndex);
    } catch (DataAccessException ex) {
      close();
      throw ex;
    }
  }
}

相关文章

微信公众号

最新文章

更多

Jedis类方法