Java Code Examples for redis.clients.jedis.Jedis#zrevrank()

The following examples show how to use redis.clients.jedis.Jedis#zrevrank() . You can vote up the ones you like or vote down the ones you don't like, and go to the original project or source file by following the links above each example. You may check out the related API usage on the sidebar.
Example 1
Source File: KarmaDB.java    From VileBot with MIT License 6 votes vote down vote up
/**
 * Get the rank of a noun based on its karma.
 * 
 * @param noun The noun to query the rank of
 * @return Integer iff the noun has a defined value, else null
 */
public static Integer getNounRank( String noun )
{
    Jedis jedis = pool.getResource();
    Long rank;
    try
    {
        rank = jedis.zrevrank( keyOfKarmaSortedSet, noun );
    }
    finally
    {
        pool.returnResource( jedis );
    }

    if ( rank == null )
    {
        return null;
    }

    return Integer.valueOf( rank.intValue() + 1 );
}
 
Example 2
Source File: ChurchDB.java    From VileBot with MIT License 6 votes vote down vote up
/**
 * Get the rank of a noun based on its karma.
 *
 * @param noun The noun to query the rank of
 * @return Integer iff the noun has a defined value, else null
 */
public static Integer getDonorRank( String noun )
{
    Jedis jedis = pool.getResource();
    Long rank;
    try
    {
        rank = jedis.zrevrank( keyOfChurchDonorSortedSet, noun );
    }
    finally
    {
        pool.returnResource( jedis );
    }
    if ( rank == null )
    {
        return null;
    }

    return rank.intValue() + 1;
}
 
Example 3
Source File: JedisUtils.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * 通过key返回zset中value的排名
 * </p>
 * <p>
 * 下标从大到小排序
 * </p>
 *
 * @param key
 * @param member
 * @return
 */
public Long zrevrank(String key, String member) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = jedisPool.getResource();
        res = jedis.zrevrank(key, member);
    } catch (Exception e) {

        log.error(e.getMessage());
    } finally {
        returnResource(jedisPool, jedis);
    }
    return res;
}
 
Example 4
Source File: RedisServiceImpl.java    From ace-cache with Apache License 2.0 5 votes vote down vote up
@Override
public Long zrevrank(String key, String member) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = pool.getResource();
        res = jedis.zrevrank(key, member);
    } catch (Exception e) {

        LOGGER.error(e.getMessage());
    } finally {
        returnResource(pool, jedis);
    }
    return res;
}
 
Example 5
Source File: DefaultRedis.java    From craft-atom with MIT License 4 votes vote down vote up
private Long zrevrank0(Jedis j, String key, String member) {
	return j.zrevrank(key, member);
}
 
Example 6
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 获取指定值在集合中的位置,集合排序从高到低
 * 
 * @see zrank
 * @param String
 *            key
 * @param String
 *            member
 * @return long 位置
 * */
public long zrevrank(String key, String member) {
	// ShardedJedis sjedis = getShardedJedis();
	Jedis sjedis = getJedis();
	long index = sjedis.zrevrank(key, member);
	returnJedis(sjedis);
	return index;
}