gpt4 book ai didi

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

转载 作者:知者 更新时间:2024-03-15 14:22:40 29 4
gpt4 key购买 nike

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

ZSetOperations.rangeByScore介绍

[英]Get elements where score is between min and max from sorted set.
[中]从排序集中获取得分介于最小值和最大值之间的元素。

代码示例

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

@Override
public Set<V> rangeByScore(double min, double max) {
  return ops.rangeByScore(getKey(), min, max);
}

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

/**
 * 根据Score值查询集合元素
 *
 * @param key
 * @param min 最小值
 * @param max 最大值
 * @return
 */
public Set<String> zRangeByScore(String key, double min, double max) {
  return redisTemplate.opsForZSet().rangeByScore(key, min, max);
}

代码示例来源:origin: davidmarquis/redis-scheduler

@Override
  public Optional<String> firstByScore(String key, long minScore, long maxScore) {
    return ops.opsForZSet()
         .rangeByScore(key, minScore, maxScore, 0, 1)
         .stream()
         .findFirst();
  }
}

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

@Override
public Set<V> rangeByScore(double min, double max) {
  return ops.rangeByScore(getKey(), min, max);
}

代码示例来源:origin: 5-Ason/ason-spring-cloud

/**
   * 有序集合获取
   * @param key
   * @param scoure
   * @param scoure1
   * @return
   */
  public Set<Object> rangeByScore(String key,double scoure,double scoure1){
    ZSetOperations<String, Object> zset = redisTemplate.opsForZSet();
    return zset.rangeByScore(key, scoure, scoure1);
  }
}

代码示例来源:origin: xuyaohui/cloud-ida-cli

/**
   * 有序集合获取
   * @param key
   * @param scoure
   * @param scoure1
   * @return
   */
  public Set<Object> rangeByScore(String key,double scoure,double scoure1){
    ZSetOperations<String, Object> zset = redisTemplate.opsForZSet();
    return zset.rangeByScore(key, scoure, scoure1);
  }
}

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

@Override
public Set<V> rangeByScore(double min, double max) {
  return ops.rangeByScore(getKey(), min, max);
}

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

@Override
public List<NotificationRetryEvent> getEventsToRetry(final long currentTimestamp, final long limit) {
 LOGGER.debug("Querying notification events to retry with a delay time between 0 and {} and limited to {} events", currentTimestamp, limit);
 final Set<String> events = redisTemplate.opsForZSet().rangeByScore(SORTED_SET_KEY, 0, currentTimestamp, 0, limit);
 LOGGER.debug("Found {} notification events which should be redelivered now ", events.size());
 final List<NotificationRetryEvent> notificationEvents = new ArrayList<NotificationRetryEvent>();
 for (final String notifEventJson : events) {
  notificationEvents.add(eventParser.unmarshall(notifEventJson));
 }
 return notificationEvents;
}

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

public List<InternalAlert> checkFrozenAlerts() {
 final long currentTimestamp = System.currentTimeMillis();
 LOGGER.debug("Querying frozen alerts with a timeout between 0 and {}", currentTimestamp);
 final Set<String> members = redisTemplate.opsForZSet().rangeByScore(SORTED_SET_KEY, 0, currentTimestamp);
 LOGGER.debug("Found {} alerts which must publish a frozen alarm", members.size());
 final List<InternalAlert> alerts = new ArrayList<InternalAlert>();
 for (final String member : members) {
  final String[] tokens = member.split(Constants.REDIS_MEMBER_TOKEN);
  final InternalAlert alert = new InternalAlert(tokens[2]);
  alert.setProviderId(tokens[0]);
  alert.setSensorId(tokens[1]);
  alerts.add(alert);
 }
 return alerts;
}

代码示例来源:origin: chenerzhu/proxy-pool

@Override
public boolean isExist(ProxyIp proxyIp) {
  Set<Serializable> set = redisCacheTemplate.opsForZSet().rangeByScore(RedisKey.PROXY_IP_KEY, proxyIp.getId(), proxyIp.getId());
  if (set.isEmpty()) {
    return false;
  } else {
    return true;
  }
}

代码示例来源:origin: chenerzhu/proxy-pool

@Override
public boolean isExistRt(ProxyIp proxyIp) {
  Set<Serializable> set = redisCacheTemplate.opsForZSet().rangeByScore(RedisKey.PROXY_IP_RT_KEY, proxyIp.getId(), proxyIp.getId());
  if (set.isEmpty()) {
    return false;
  } else {
    return true;
  }
}

代码示例来源:origin: eventuate-examples/eventuate-examples-restaurant-management

@Override
public List<RestaurantInfo> findAvailableRestaurants(Address deliveryAddress, DeliveryTime deliveryTime) {
  String zipCode = deliveryAddress.getZip();
  int dayOfWeek = deliveryTime.getDayOfWeek();
  int timeOfDay = deliveryTime.getTimeOfDay();
  String closingTimesKey = closingTimesKey(zipCode, dayOfWeek);
  Set<String> restaurantIds =
      redisTemplate.opsForZSet().rangeByScore(closingTimesKey, timeOfDay, 2359).stream()
      .map(tr -> tr.split("_"))
      .filter(v -> Integer.parseInt(v[0]) <= timeOfDay)
      .map(v -> v[1])
      .collect(Collectors.toSet());
  Collection<String> keys = keyFormatter.keys(restaurantIds);
  return restaurantTemplate.opsForValue().multiGet(keys);
}

29 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com