public Long del(String key) { return dynoClient.del(key); }
@Override public Status delete(String table, String key) { return jedis.del(key) == 0 && jedis.zrem(INDEX_KEY, key) == 0 ? Status.ERROR : Status.OK; }
public void del(String key) { call(jedis -> jedis.del(key)); }
@Override public void close() throws IOException { jedis.del(PREFIX_LOK); } };
public Long del(String key) { return dynoClient.del(key); }
private void deleteLock(JedisCommands client, String agentType) { client.del(agentType); }
@Override public void run() { try { jedis.del(PREFIX_USE + workerId); jedis.lrem(PREFIX_PID, 0, Os.PID_STRING + "x" + workerId); } catch (Exception ex) { // ignore all } } });
public void del(String key) { call(jedis -> jedis.del(key)); }
@Override public void clear() { execute("clear", "(a shard in) " + queueName, () -> { for (String shard : allShards) { String queueShard = getQueueShardKey(queueName, shard); String unackShard = getUnackKey(queueName, shard); quorumConn.del(queueShard); quorumConn.del(unackShard); } quorumConn.del(messageStoreKey); return null; }); }
private String findUsableWorkerId(List<String> pidWorkerIds) { String lastWorkerId = null; for (val pidWorkerId : pidWorkerIds) { val pidAndWorkerId = pidWorkerId.split("x"); int pid = Integer.parseInt(pidAndWorkerId[0]); val stillAllive = Os.isStillAlive(pid); if (stillAllive) { continue; } jedis.lrem(PREFIX_PID, 0, pidWorkerId); if (lastWorkerId != null) { // keep last one for reuse jedis.del(PREFIX_USE + lastWorkerId); } lastWorkerId = pidAndWorkerId[1]; } return lastWorkerId; }
/** {@inheritDoc} **/ @Override public void del(String key, String subkey) { JedisCommands jedis = this.getInstanceByKey(key); jedis.del(concat(key, subkey)); }
/** {@inheritDoc} **/ @Override public void del(String key, String subkey) { JedisCommands jedis = this.getInstanceByKey(key); jedis.del(concat(key, subkey)); }
@Override public void removeFromGroup(String cacheGroupKey, String key) { JedisCommands commands = JedisProviderFactory.getJedisCommands(null); try { commands.zrem(cacheGroupKey, key); // commands.del(key); } finally{ JedisProviderFactory.getJedisProvider(null).release(); } }
Set<String> _keys = _holder.getCommands().hkeys(__cacheName); for (String _key : _keys) { _holder.getCommands().del(__cacheName.concat(__separator).concat(_key)); _holder.getCommands().del(__cacheName); } else { Set<String> _keys = _holder.getJedis().keys(__cacheName.concat(__separator).concat("*")); for (String _key : _keys) { _holder.getCommands().del(_key);
@Override public void clearGroup(final String groupName,final boolean containPkCache) { String cacheGroupKey = groupName + CacheHandler.GROUPKEY_SUFFIX; JedisCommands commands = JedisProviderFactory.getJedisCommands(null); try { Set<String> keys = commands.zrange(cacheGroupKey, 0, -1); //删除实际的缓存 if(keys != null && keys.size() > 0){ RedisBatchCommand.removeObjects(keys.toArray(new String[0])); } commands.del(cacheGroupKey); //删除按ID缓存的 if(containPkCache){ keys = JedisProviderFactory.getMultiKeyCommands(null).keys(groupName +".id:*"); if(keys != null && keys.size() > 0){ RedisBatchCommand.removeObjects(keys.toArray(new String[0])); } } } finally{ JedisProviderFactory.getJedisProvider(null).release(); } }
@Override public @Nonnull Execution retrieveOrchestrationForCorrelationId( @Nonnull String correlationId) throws ExecutionNotFoundException { String key = format("correlation:%s", correlationId); return getRedisDelegate(key).withCommandsClient(correlationRedis -> { String orchestrationId = correlationRedis.get(key); if (orchestrationId != null) { Execution orchestration = retrieveInternal( getRedisDelegate(orchestrationKey(orchestrationId)), ORCHESTRATION, orchestrationId); if (!orchestration.getStatus().isComplete()) { return orchestration; } correlationRedis.del(key); } throw new ExecutionNotFoundException( format("No Orchestration found for correlation ID %s", correlationId) ); }); }
@Nonnull @Override public Execution retrievePipelineForCorrelationId(@Nonnull String correlationId) throws ExecutionNotFoundException { String key = format("pipelineCorrelation:%s", correlationId); return getRedisDelegate(key).withCommandsClient(correlationRedis -> { String pipelineId = correlationRedis.get(key); if (pipelineId != null) { Execution pipeline = retrieveInternal( getRedisDelegate(pipelineKey(pipelineId)), PIPELINE, pipelineId ); if (!pipeline.getStatus().isComplete()) { return pipeline; } correlationRedis.del(key); } throw new ExecutionNotFoundException( format("No Pipeline found for correlation ID %s", correlationId) ); }); }
private boolean acquireRunKey(String agentType, long timeout) { // This isn't as safe as the vanilla Redis impl because the call isn't atomic, but it's the best we can do until // dynomite adds support for `String set(String key, String value, String nxxx, String expx, long time)` (which // they are working on). String identity = nodeIdentity.getNodeIdentity(); return redisClientDelegate.withCommandsClient(client -> { return Failsafe .with(ACQUIRE_LOCK_RETRY_POLICY) .get(() -> { String response = client.get(agentType); if (response == null && client.setnx(agentType, identity) == 1) { client.pexpireAt(agentType, System.currentTimeMillis() + timeout); return true; } if (client.ttl(agentType) == -1) { log.warn("Detected potential deadlocked agent, removing lock key: " + agentType); client.del(agentType); } return false; }); }); }
/** * 删除给定的一个 key 。 * * 不存在的 key 会被忽略。 * * @param keyBytes * @return true:存在该key删除时返回 * * false:不存在该key */ public boolean remove() { try { if(!isBinary)return getJedisCommands(groupName).del(key) == 1; if(isCluster(groupName)){ return getBinaryJedisClusterCommands(groupName).del(keyBytes) == 1; } return getBinaryJedisCommands(groupName).del(keyBytes) == 1; } finally { getJedisProvider(groupName).release(); } }
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); } }); }