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

The following examples show how to use redis.clients.jedis.Jedis#strlen() . 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: LogDB.java    From VileBot with MIT License 6 votes vote down vote up
public static void addItem( String chatMessage )
{
    Jedis jedis = pool.getResource();
    try
    {
        if ( jedis.strlen( logKey ) > MAX_LOG_SIZE )
        {
            jedis.set( logKey, StringUtils.right( jedis.get( logKey ), MAX_LOG_SIZE - chatMessage.length() ) );
        }
        jedis.append( logKey, chatMessage );
    }
    finally
    {
        pool.returnResource( jedis );
    }
}
 
Example 2
Source File: JedisUtils.java    From fw-spring-cloud with Apache License 2.0 5 votes vote down vote up
/**
 * <p>
 * 通过key获取value值的长度
 * </p>
 *
 * @param key
 * @return 失败返回null
 */
public Long serlen(String key) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = jedisPool.getResource();
        res = jedis.strlen(key);
    } catch (Exception e) {

        log.error(e.getMessage());
    } finally {
        returnResource(jedisPool, jedis);
    }
    return res;
}
 
Example 3
Source File: JedisUtil.java    From Project with Apache License 2.0 5 votes vote down vote up
/**
 * 获取key对应的值的长度
 * 
 * @param  key
 * @return value值得长度
 */
public long strlen(String key) {
	Jedis jedis = getJedis();
	long len = jedis.strlen(key);
	jedis.close();
	return len;
}
 
Example 4
Source File: RedisServiceImpl.java    From ace-cache with Apache License 2.0 5 votes vote down vote up
@Override
public Long serlen(String key) {
    Jedis jedis = null;
    Long res = null;
    try {
        jedis = pool.getResource();
        res = jedis.strlen(key);
    } 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 strlen0(Jedis j, String key) {
	return j.strlen(key);
}
 
Example 6
Source File: JedisUtil.java    From BigData with GNU General Public License v3.0 3 votes vote down vote up
/**
 * 获取key对应的值的长度
 * 
 * @param String
 *            key
 * @return value值得长度
 * */
public long strlen(String key) {
	Jedis jedis = getJedis();
	long len = jedis.strlen(key);
	returnJedis(jedis);
	return len;
}