Time complexity O(1) @param key @return the cardinality (number of elements) of the set as an integer.
242243244245246247248249250251252
return zadd; } public Long zcard() { Jedis jedis = getResource(); Long zadd = jedis.zcard(key()); returnResource(jedis); return zadd; } private void returnResource(final Jedis jedis) {
200201202203204205206207208209210
String key = RedisSessionKeys.getSessionsKey(); Long result; Jedis jedis = pool.getResource(); try { result = jedis.zcard(key); pool.returnResource(jedis); } catch (Throwable e) { pool.returnBrokenResource(jedis); throw new RuntimeException(e); }