Java Code Examples for org.springframework.data.redis.connection.RedisConnection#exists()

The following examples show how to use org.springframework.data.redis.connection.RedisConnection#exists() . 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: RedisService.java    From xmfcn-spring-cloud with Apache License 2.0 6 votes vote down vote up
/**
 * 判断key是否存在
 *
 * @param key
 * @return
 */
@RequestMapping("exists")
public Boolean exists(String key) {
    Boolean result = false;
    if (StringUtil.isBlank(key)) {
        return result;
    }
    RedisConnection conn = getRedisConnection();
    if (conn == null) {
        return result;
    }
    try {
        result = conn.exists(key.getBytes());
    } catch (Exception e) {
        logger.error(StringUtil.getExceptionMsg(e));
    }
    return result;
}
 
Example 2
Source File: CustomRedisCacheWriter.java    From spring-microservice-exam with MIT License 4 votes vote down vote up
boolean doCheckLock(String name, RedisConnection connection) {
    return connection.exists(createCacheLockKey(name));
}
 
Example 3
Source File: DefaultRedisCacheWriter.java    From black-shop with Apache License 2.0 4 votes vote down vote up
boolean doCheckLock(String name, RedisConnection connection) {
	return connection.exists(createCacheLockKey(name));
}
 
Example 4
Source File: DefaultRedisCacheWriter.java    From gateway-helper with Apache License 2.0 4 votes vote down vote up
boolean doCheckLock(String name, RedisConnection connection) {
    return connection.exists(createCacheLockKey(name));
}
 
Example 5
Source File: DefaultRedisCacheWriter.java    From api-gateway-old with Apache License 2.0 4 votes vote down vote up
boolean doCheckLock(String name, RedisConnection connection) {
    return connection.exists(createCacheLockKey(name));
}