org.springframework.data.redis.core.SetOperations.pop()方法的使用及代码示例

x33g5p2x  于2022-01-30 转载在 其他  
字(2.8k)|赞(0)|评价(0)|浏览(105)

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

SetOperations.pop介绍

[英]Remove and return a random member from set at key.
[中]从set at key中删除并返回随机成员。

代码示例

代码示例来源:origin: spring-projects/spring-data-redis

@Override
public V pop() {
  return ops.pop(getKey());
}

代码示例来源:origin: whvcse/EasyWeb

/**
 * 移除并返回集合的一个随机元素
 *
 * @param key
 * @return
 */
public String sPop(String key) {
  return redisTemplate.opsForSet().pop(key);
}

代码示例来源:origin: souyunku/SpringBootExamples

/**
 * key 缓存Key
 * @param key
 * @return
 */
public static String getFromSet(String key) {
  return cacheUtils.redisTemplate.opsForSet().pop(key);
}

代码示例来源:origin: heibaiying/spring-samples-for-all

/***
 * 集合弹出元素
 */
public String SetPop(String key) {
  SetOperations<String, String> setOperations = redisTemplate.opsForSet();
  return setOperations.pop(key);
}

代码示例来源:origin: heibaiying/spring-samples-for-all

/***
 * 集合弹出元素
 */
public Object SetPop(Object key) {
  SetOperations<Object, Object> setOperations = objectRedisTemplate.opsForSet();
  return setOperations.pop(key);
}

代码示例来源:origin: org.springframework.data/spring-data-redis

@Override
public V pop() {
  return ops.pop(getKey());
}

代码示例来源:origin: gudaoxuri/dew

@Override
public String spop(String key) {
  return redisTemplate.opsForSet().pop(key);
}

代码示例来源:origin: aillamsun/devX

@Override
public String spop(String key) {
  return redisTemplate.opsForSet().pop(key);
}

代码示例来源:origin: apache/servicemix-bundles

@Override
public V pop() {
  return ops.pop(getKey());
}

代码示例来源:origin: ihaolin/antares

@Override
public Long pullShardFromNewShardsSet(Long instanceId) {
  String shardsKey = RedisKeys.keyOfJobInstanceStatusShards(instanceId, JobInstanceShardStatus.NEW);
  String shardId = redis.opsForSet().pop(shardsKey);
  return Strings.isNullOrEmpty(shardId) ? null : Long.valueOf(shardId);
}

代码示例来源:origin: sentilo/sentilo

@Scheduled(initialDelay = 120000, fixedDelay = 300000)
public void run() {
 // pending events are read and processed one by one until a maximum of MAX_SIZE readings is
 // reached.
 int numReadings = 0;
 boolean emptyQueue = false;
 while (!emptyQueue && numReadings < MAX_SIZE) {
  final String jsonEvent = redisTemplate.opsForSet().pop(getQueueName());
  numReadings++;
  if (!StringUtils.hasText(jsonEvent) || jsonEvent.equals(NIL)) {
   emptyQueue = true;
  } else {
   final EventMessage eventMessage = (EventMessage) converter.unmarshal(jsonEvent, EventMessage.class);
   pendingEventService.process(eventMessage);
  }
 }
}

代码示例来源:origin: dqeasycloud/easy-cloud

/**
 * <p>
 * 移除set中的一个随机元素,并返回该元素
 * </p>
 * <p>
 * <pre>
 * </pre>
 *
 * @param key
 * @param clazz
 * @return
 * @author daiqi
 * @date 2017年12月19日 上午9:37:09
 */
public static <T> T popOfSet(String key, Class<T> clazz) {
  if (EcStringUtils.isEmpty(key) || EcBaseUtils.isNull(clazz)) {
    return null;
  }
  return EcJSONUtils.parseObject(stringRedisTemplate.opsForSet().pop(key), clazz);
}

相关文章