本文整理了Java中redis.clients.jedis.JedisCommands.srem()
方法的一些代码示例,展示了JedisCommands.srem()
的具体用法。这些代码示例主要来源于Github
/Stackoverflow
/Maven
等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JedisCommands.srem()
方法的具体详情如下:
包路径:redis.clients.jedis.JedisCommands
类名称:JedisCommands
方法名:srem
暂无
代码示例来源:origin: Netflix/conductor
public Long srem(String key, String member) {
logger.trace("srem {} {}", key, member);
Long retVal = dynoClient.srem(key, member);
return retVal;
}
代码示例来源:origin: mpusher/mpush
public void sRem(String key, String value) {
call(jedis -> jedis.srem(key, value));
}
代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence
public Long srem(String key, String member) {
logger.trace("srem {} {}", key, member);
Long retVal = dynoClient.srem(key, member);
return retVal;
}
代码示例来源:origin: com.github.mpusher/mpush-cache
public void sRem(String key, String value) {
call(jedis -> jedis.srem(key, value));
}
代码示例来源:origin: vakinge/jeesuite-libs
public boolean remove(String... strs) {
try {
return getJedisCommands(groupName).srem(key,strs) == 1;
} finally{
getJedisProvider(groupName).release();
}
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
@Override
public void updateStatus(ExecutionType type, @Nonnull String id, @Nonnull ExecutionStatus status) {
ImmutablePair<String, RedisClientDelegate> pair = fetchKey(id);
RedisClientDelegate delegate = pair.getRight();
String key = pair.getLeft();
delegate.withCommandsClient(c -> {
Map<String, String> data = new HashMap<>();
data.put("status", status.name());
if (status == ExecutionStatus.RUNNING) {
data.put("canceled", "false");
data.put("startTime", String.valueOf(currentTimeMillis()));
} else if (status.isComplete() && c.hget(key, "startTime") != null) {
data.put("endTime", String.valueOf(currentTimeMillis()));
}
if (status == BUFFERED) {
c.sadd(allBufferedExecutionsKey(type), id);
} else {
c.srem(allBufferedExecutionsKey(type), id);
}
c.hmset(key, data);
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
@Override
public void cancel(ExecutionType type, @Nonnull String id, String user, String reason) {
ImmutablePair<String, RedisClientDelegate> pair = fetchKey(id);
RedisClientDelegate delegate = pair.getRight();
delegate.withCommandsClient(c -> {
Map<String, String> data = new HashMap<>();
data.put("canceled", "true");
if (StringUtils.isNotEmpty(user)) {
data.put("canceledBy", user);
}
if (StringUtils.isNotEmpty(reason)) {
data.put("cancellationReason", reason);
}
ExecutionStatus currentStatus = ExecutionStatus.valueOf(c.hget(pair.getLeft(), "status"));
if (currentStatus == ExecutionStatus.NOT_STARTED) {
data.put("status", ExecutionStatus.CANCELED.name());
}
c.hmset(pair.getLeft(), data);
c.srem(allBufferedExecutionsKey(type), id);
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
c.zrem(lookupKey, executionId);
} else {
c.srem(lookupKey, executionId);
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
private void deleteInternal(RedisClientDelegate delegate, ExecutionType type, String id) {
delegate.withCommandsClient(c -> {
String key = executionKey(type, id);
try {
String application = c.hget(key, "application");
String appKey = appKey(type, application);
c.srem(appKey, id);
c.srem(allBufferedExecutionsKey(type), id);
if (type == PIPELINE) {
String pipelineConfigId = c.hget(key, "pipelineConfigId");
c.zrem(executionsByPipelineKey(pipelineConfigId), id);
}
} catch (ExecutionNotFoundException ignored) {
// do nothing
} finally {
c.del(key);
c.srem(alljobsKey(type), id);
}
});
}
代码示例来源:origin: com.netflix.spinnaker.clouddriver/clouddriver-core
public void addToHistory(DefaultTaskStatus status, JedisTask task) {
String historyId = "taskHistory:" + task.getId();
Map<String, String> data = new HashMap<>();
data.put("phase", status.getPhase());
data.put("status", status.getStatus());
data.put("state", status.getState().toString());
String hist;
try {
hist = mapper.writeValueAsString(data);
} catch (JsonProcessingException e) {
throw new RuntimeException("Failed converting task history to json", e);
}
retry(() -> redisClientDelegate.withCommandsClient(client -> {
client.rpush(historyId, hist);
client.expire(historyId, TASK_TTL);
if (status.isCompleted()) {
client.srem(RUNNING_TASK_KEY, task.getId());
}
}), format("Adding status history to task %s: %s", task.getId(), status));
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
@Override
public void pause(ExecutionType type, @Nonnull String id, String user) {
ImmutablePair<String, RedisClientDelegate> pair = fetchKey(id);
RedisClientDelegate delegate = pair.getRight();
delegate.withCommandsClient(c -> {
ExecutionStatus currentStatus = ExecutionStatus.valueOf(c.hget(pair.getLeft(), "status"));
if (currentStatus != ExecutionStatus.RUNNING) {
throw new UnpausablePipelineException(format(
"Unable to pause pipeline that is not RUNNING (executionId: %s, currentStatus: %s)",
id,
currentStatus
));
}
PausedDetails pausedDetails = new PausedDetails();
pausedDetails.setPausedBy(user);
pausedDetails.setPauseTime(currentTimeMillis());
Map<String, String> data = new HashMap<>();
try {
data.put("paused", mapper.writeValueAsString(pausedDetails));
} catch (JsonProcessingException e) {
throw new ExecutionSerializationException("Failed converting pausedDetails to json", e);
}
data.put("status", ExecutionStatus.PAUSED.toString());
c.hmset(pair.getLeft(), data);
c.srem(allBufferedExecutionsKey(type), id);
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
@Override
public void resume(ExecutionType type, @Nonnull String id, String user, boolean ignoreCurrentStatus) {
ImmutablePair<String, RedisClientDelegate> pair = fetchKey(id);
RedisClientDelegate delegate = pair.getRight();
delegate.withCommandsClient(c -> {
ExecutionStatus currentStatus = ExecutionStatus.valueOf(c.hget(pair.getLeft(), "status"));
if (!ignoreCurrentStatus && currentStatus != ExecutionStatus.PAUSED) {
throw new UnresumablePipelineException(format(
"Unable to resume pipeline that is not PAUSED (executionId: %s, currentStatus: %s)",
id,
currentStatus
));
}
try {
PausedDetails pausedDetails = mapper.readValue(c.hget(pair.getLeft(), "paused"), PausedDetails.class);
pausedDetails.setResumedBy(user);
pausedDetails.setResumeTime(currentTimeMillis());
Map<String, String> data = new HashMap<>();
data.put("paused", mapper.writeValueAsString(pausedDetails));
data.put("status", ExecutionStatus.RUNNING.toString());
c.hmset(pair.getLeft(), data);
c.srem(allBufferedExecutionsKey(type), id);
} catch (IOException e) {
throw new ExecutionSerializationException("Failed converting pausedDetails to json", e);
}
});
}
代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis
c.sadd(allBufferedExecutionsKey(execution.getType()), execution.getId());
} else {
c.srem(allBufferedExecutionsKey(execution.getType()), execution.getId());
内容来源于网络,如有侵权,请联系作者删除!