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

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

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

JedisCluster.scard介绍

暂无

代码示例

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

@Override
public Long sCard(byte[] key) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().scard(key);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: dufyun/learn-tech-collection

/**
 * 返回集合 key 的基数(集合中元素的数量)。
 * @param key
 * @return
 */
public Long scard(String key) {
  return jedisCluster.scard(key);
}

代码示例来源:origin: net.oschina.j2cache/j2cache-core

@Override
public Long scard(byte[] bytes) {
  return cluster.scard(bytes);
}

代码示例来源:origin: hhfcyong/xxxx-dubbo

/**
 * 返回集合 key 的基数(集合中元素的数量)
 * @param key
 * @return 集合的基数,当 key 不存在时,返回 0 
 */
public long scard(String key){
  return jedisCluster.scard(key);
}
/**

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

public Long scard(String key) {
  return jedisCluster.scard(key);
}

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

public Long scard(byte[] key) {
  return jedisCluster.scard(key);
}

代码示例来源:origin: pivotalsoftware/session-managers

@Override
public Integer count(String sessionsKey) {
  return jedisCluster.scard(sessionsKey).intValue();
}

代码示例来源:origin: yangfuhai/jboot

/**
 * 返回集合 key 的基数(集合中元素的数量)。
 */
public Long scard(Object key) {
  return jedisCluster.scard(keyToBytes(key));
}

代码示例来源:origin: com.github.yamingd.argo/argo-redis

@Override
public Long scard(String key) {
  return jedisCluster.scard(SafeEncoder.encode(key));
}

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

@Override
public Long sCard(byte[] key) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().scard(key);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: org.nanoframework/nano-orm-jedis

@Override
public long scard(final String key) {
  Assert.hasText(key);
  try {
    return cluster.scard(key);
  } catch (final Throwable e) {
    throw new RedisClientException(e.getMessage(), e);
  }
}

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

@Override
public Long sCard(byte[] key) {
  Assert.notNull(key, "Key must not be null!");
  try {
    return connection.getCluster().scard(key);
  } catch (Exception ex) {
    throw convertJedisAccessException(ex);
  }
}

代码示例来源:origin: yrain/smart-cache

/**
 * 返回 key 中元素的数量
 */
public Long scard(Object key) {
  if (null == key) {
    return null;
  }
  if (cluster) {
    return jedisCluster.scard(serializeKey(key));
  } else {
    return jedisOperator.scard(serializeKey(key));
  }
}

代码示例来源:origin: pivotalsoftware/session-managers

@Test
public void count() {
  when(this.jedisCluster.scard(SESSIONS_KEY)).thenReturn(10L);
  Integer result = this.jedisPoolTemplate.count(SESSIONS_KEY);
  assertEquals(10, result.intValue());
  verify(this.jedisCluster, times(1)).scard(SESSIONS_KEY);
}

相关文章

微信公众号

最新文章

更多

JedisCluster类方法