本文整理了Java中redis.clients.jedis.JedisCommands.exists()
方法的一些代码示例,展示了JedisCommands.exists()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JedisCommands.exists()
方法的具体详情如下:
包路径:redis.clients.jedis.JedisCommands
类名称:JedisCommands
方法名:exists
暂无
代码示例来源:origin: apache/storm
found = jedisCommand.exists(key);
break;
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
@Override
public boolean hasExecution(@Nonnull ExecutionType type, @Nonnull String id) {
return redisClientDelegate.withCommandsClient(c -> {
return c.exists(executionKey(type, id));
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
private RedisClientDelegate getRedisDelegate(String key) {
if (Strings.isNullOrEmpty(key) || !previousRedisClientDelegate.isPresent()) {
return redisClientDelegate;
}
RedisClientDelegate delegate = redisClientDelegate.withCommandsClient(c -> {
if (c.exists(key)) {
return redisClientDelegate;
} else {
return null;
}
});
if (delegate == null) {
delegate = previousRedisClientDelegate.get().withCommandsClient(c -> {
if (c.exists(key)) {
return previousRedisClientDelegate.get();
} else {
return null;
}
});
}
return (delegate == null) ? redisClientDelegate : delegate;
}
代码示例来源:origin: com.gitee.zhaohuihua/bdp-general-svc
/** {@inheritDoc} **/
@Override
public boolean exist(String key, String subkey) {
JedisCommands jedis = this.getInstanceByKey(key);
return jedis.exists(concat(key, subkey));
}
代码示例来源:origin: com.gitee.qdbp/qdbp-general-biz
/** {@inheritDoc} **/
@Override
public boolean exist(String key, String subkey) {
JedisCommands jedis = this.getInstanceByKey(key);
return jedis.exists(concat(key, subkey));
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
private RedisClientDelegate getRedisDelegate(ExecutionType type, String id) {
if (StringUtils.isBlank(id) || !previousRedisClientDelegate.isPresent()) {
return redisClientDelegate;
}
RedisClientDelegate delegate = redisClientDelegate.withCommandsClient(c -> {
if (c.exists(executionKey(type, id))) {
return redisClientDelegate;
} else {
return null;
}
});
if (delegate == null) {
delegate = previousRedisClientDelegate.get().withCommandsClient(c -> {
if (c.exists(executionKey(type, id))) {
return previousRedisClientDelegate.get();
} else {
return null;
}
});
}
return (delegate == null) ? redisClientDelegate : delegate;
}
代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-core
redisClientDelegate.withCommandsClient(client -> {
onDemandKeys.stream()
.filter(k -> client.exists(provider.getProviderName() + "onDemand:attributes:" + k))
.forEach(k -> existingOnDemandKeys.put(k, new StaticResponse(Boolean.TRUE)));
});
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
protected Execution retrieveInternal(RedisClientDelegate delegate, ExecutionType type, String id) throws ExecutionNotFoundException {
String key = executionKey(type, id);
String indexKey = format("%s:stageIndex", key);
boolean exists = delegate.withCommandsClient(c -> {
return c.exists(key);
});
if (!exists) {
throw new ExecutionNotFoundException("No " + type + " found for " + id);
}
final Map<String, String> map = new HashMap<>();
final List<String> stageIds = new ArrayList<>();
delegate.withTransaction(tx -> {
Response<Map<String, String>> execResponse = tx.hgetAll(key);
Response<List<String>> indexResponse = tx.lrange(indexKey, 0, -1);
tx.exec();
map.putAll(execResponse.get());
if (!indexResponse.get().isEmpty()) {
stageIds.addAll(indexResponse.get());
} else {
stageIds.addAll(extractStages(map));
}
});
Execution execution = new Execution(type, id, map.get("application"));
return buildExecution(execution, map, stageIds);
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
protected ImmutablePair<String, RedisClientDelegate> fetchKey(String id) {
ImmutablePair<String, RedisClientDelegate> pair = redisClientDelegate.withCommandsClient(c -> {
if (c.exists(pipelineKey(id))) {
return ImmutablePair.of(pipelineKey(id), redisClientDelegate);
} else if (c.exists(orchestrationKey(id))) {
return ImmutablePair.of(orchestrationKey(id), redisClientDelegate);
}
return ImmutablePair.nullPair();
});
if (pair.getLeft() == null && previousRedisClientDelegate.isPresent()) {
RedisClientDelegate delegate = previousRedisClientDelegate.get();
pair = delegate.withCommandsClient(c -> {
if (c.exists(pipelineKey(id))) {
return ImmutablePair.of(pipelineKey(id), delegate);
} else if (c.exists(orchestrationKey(id))) {
return ImmutablePair.of(orchestrationKey(id), delegate);
}
return null;
});
}
if (pair.getLeft() == null) {
throw new ExecutionNotFoundException("No execution found with id " + id);
}
return pair;
}
代码示例来源:origin: suninformation/ymate-platform-v2
@Override
public Object get(Object key) throws CacheException {
IRedisCommandsHolder _holder = null;
try {
_holder = __redis.getDefaultCommandsHolder();
String _cacheKey = __doSerializeKey(key);
Object _cacheValue;
if (__storageWithSet) {
_cacheValue = __doUnserializeValue(_holder.getCommands().hget(__cacheName, _cacheKey));
if (!__disabledSubscribeExpired && _cacheValue != null && !_holder.getCommands().exists(__cacheName.concat(__separator).concat(_cacheKey))) {
remove(key);
}
} else {
_cacheValue = __doUnserializeValue(_holder.getCommands().get(__cacheName.concat(__separator).concat(_cacheKey)));
}
return _cacheValue;
} catch (Exception e) {
throw new CacheException(RuntimeUtils.unwrapThrow(e));
} finally {
if (_holder != null) {
_holder.release();
}
}
}
代码示例来源:origin: vakinge/jeesuite-libs
/**
* 检查给定 key 是否存在。
*
* @param keyBytes
* @return
*/
public boolean exists() {
try {
if(!isBinary)return getJedisCommands(groupName).exists(key);
if(isCluster(groupName)){
return getBinaryJedisClusterCommands(groupName).exists(keyBytes);
}
return getBinaryJedisCommands(groupName).exists(keyBytes);
} finally {
getJedisProvider(groupName).release();
}
}
内容来源于网络,如有侵权,请联系作者删除!