redis.clients.jedis.JedisCommands.del()方法的使用及代码示例

x33g5p2x  于2022-01-21 转载在 其他  
字(7.1k)|赞(0)|评价(0)|浏览(241)

本文整理了Java中redis.clients.jedis.JedisCommands.del()方法的一些代码示例,展示了JedisCommands.del()的具体用法。这些代码示例主要来源于Github/Stackoverflow/Maven等平台,是从一些精选项目中提取出来的代码,具有较强的参考意义,能在一定程度帮忙到你。JedisCommands.del()方法的具体详情如下:
包路径:redis.clients.jedis.JedisCommands
类名称:JedisCommands
方法名:del

JedisCommands.del介绍

暂无

代码示例

代码示例来源:origin: Netflix/conductor

public Long del(String key) {
  return dynoClient.del(key);
}

代码示例来源:origin: brianfrankcooper/YCSB

@Override
public Status delete(String table, String key) {
 return jedis.del(key) == 0 && jedis.zrem(INDEX_KEY, key) == 0 ? Status.ERROR
   : Status.OK;
}

代码示例来源:origin: mpusher/mpush

public void del(String key) {
  call(jedis -> jedis.del(key));
}

代码示例来源:origin: com.github.bingoohuang/westid

@Override
  public void close() throws IOException {
    jedis.del(PREFIX_LOK);
  }
};

代码示例来源:origin: com.netflix.conductor/conductor-redis-persistence

public Long del(String key) {
  return dynoClient.del(key);
}

代码示例来源:origin: com.netflix.spinnaker.clouddriver/cats-dynomite

private void deleteLock(JedisCommands client, String agentType) {
 client.del(agentType);
}

代码示例来源:origin: com.github.bingoohuang/westid

@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
    }
  }
});

代码示例来源:origin: com.github.mpusher/mpush-cache

public void del(String key) {
  call(jedis -> jedis.del(key));
}

代码示例来源:origin: Netflix/dyno-queues

@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;
  });
}

代码示例来源:origin: com.github.bingoohuang/westid

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;
}

代码示例来源:origin: com.gitee.qdbp/qdbp-general-biz

/** {@inheritDoc} **/
@Override
public void del(String key, String subkey) {
  JedisCommands jedis = this.getInstanceByKey(key);
  jedis.del(concat(key, subkey));
}

代码示例来源:origin: com.gitee.zhaohuihua/bdp-general-svc

/** {@inheritDoc} **/
@Override
public void del(String key, String subkey) {
  JedisCommands jedis = this.getInstanceByKey(key);
  jedis.del(concat(key, subkey));
}

代码示例来源:origin: vakinge/jeesuite-libs

@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();
  }
}

代码示例来源:origin: suninformation/ymate-platform-v2

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);

代码示例来源:origin: vakinge/jeesuite-libs

@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();
  }

}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis

@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)
  );
 });
}

代码示例来源:origin: com.netflix.spinnaker.orca/orca-redis

@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)
  );
 });
}

代码示例来源:origin: com.netflix.spinnaker.clouddriver/cats-dynomite

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;
   });
 });
}

代码示例来源:origin: vakinge/jeesuite-libs

/**
 * 删除给定的一个 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();
  }
}

代码示例来源: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);
  }
 });
}

相关文章

微信公众号

最新文章

更多