当前位置: 首页>>代码示例>>Java>>正文


Java BoundZSetOperations类代码示例

本文整理汇总了Java中org.springframework.data.redis.core.BoundZSetOperations的典型用法代码示例。如果您正苦于以下问题:Java BoundZSetOperations类的具体用法?Java BoundZSetOperations怎么用?Java BoundZSetOperations使用的例子?那么恭喜您, 这里精选的类代码示例或许可以为您提供帮助。


BoundZSetOperations类属于org.springframework.data.redis.core包,在下文中一共展示了BoundZSetOperations类的11个代码示例,这些例子默认根据受欢迎程度排序。您可以为喜欢或者感觉有用的代码点赞,您的评价将有助于系统推荐出更棒的Java代码示例。

示例1: findAll

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
@Override
public Iterable<Metric<?>> findAll(String group) {

	BoundZSetOperations<String, String> zSetOperations = this.redisOperations
			.boundZSetOps(keyFor(group));

	Set<String> keys = zSetOperations.range(0, -1);
	Iterator<String> keysIt = keys.iterator();

	List<Metric<?>> result = new ArrayList<Metric<?>>(keys.size());
	List<String> values = this.redisOperations.opsForValue().multiGet(keys);
	for (String v : values) {
		String key = keysIt.next();
		result.add(deserialize(group, key, v, zSetOperations.score(key)));
	}
	return result;

}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:19,代码来源:RedisMultiMetricRepository.java

示例2: set

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
@Override
public void set(String group, Collection<Metric<?>> values) {
	String groupKey = keyFor(group);
	trackMembership(groupKey);
	BoundZSetOperations<String, String> zSetOperations = this.redisOperations
			.boundZSetOps(groupKey);
	for (Metric<?> metric : values) {
		String raw = serialize(metric);
		String key = keyFor(metric.getName());
		zSetOperations.add(key, metric.getValue().doubleValue());
		this.redisOperations.opsForValue().set(key, raw);
	}
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:14,代码来源:RedisMultiMetricRepository.java

示例3: increment

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
@Override
public void increment(String group, Delta<?> delta) {
	String groupKey = keyFor(group);
	trackMembership(groupKey);
	BoundZSetOperations<String, String> zSetOperations = this.redisOperations
			.boundZSetOps(groupKey);
	String key = keyFor(delta.getName());
	double value = zSetOperations.incrementScore(key, delta.getValue().doubleValue());
	String raw = serialize(
			new Metric<Double>(delta.getName(), value, delta.getTimestamp()));
	this.redisOperations.opsForValue().set(key, raw);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:13,代码来源:RedisMultiMetricRepository.java

示例4: reset

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
@Override
public void reset(String group) {
	String groupKey = keyFor(group);
	if (this.redisOperations.hasKey(groupKey)) {
		BoundZSetOperations<String, String> zSetOperations = this.redisOperations
				.boundZSetOps(groupKey);
		Set<String> keys = zSetOperations.range(0, -1);
		for (String key : keys) {
			this.redisOperations.delete(key);
		}
		this.redisOperations.delete(groupKey);
	}
	this.zSetOperations.remove(groupKey);
}
 
开发者ID:vikrammane23,项目名称:https-github.com-g0t4-jenkins2-course-spring-boot,代码行数:15,代码来源:RedisMultiMetricRepository.java

示例5: addOps

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
protected void addOps(final EmailSchedulingData emailSchedulingData) {
    final String orderingKey = orderingKey(emailSchedulingData);
    final String valueKey = emailSchedulingData.getId();

    final double score = calculateScore(emailSchedulingData);

    BoundZSetOperations<String, String> orderingZSetOps = orderingTemplate.boundZSetOps(orderingKey);
    orderingZSetOps.add(valueKey, score);
    orderingZSetOps.persist();

    BoundValueOperations<String, EmailSchedulingData> valueValueOps = valueTemplate.boundValueOps(valueKey);
    valueValueOps.set(emailSchedulingData);
    valueValueOps.persist();
}
 
开发者ID:ozimov,项目名称:spring-boot-email-tools,代码行数:15,代码来源:DefaultPersistenceService.java

示例6: getNextBatchOps

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
protected Collection<EmailSchedulingData> getNextBatchOps(final String orderingKey, final int batchMaxSize) {
    Preconditions.checkArgument(batchMaxSize > 0, "Batch size should be a positive integer.");

    final BoundZSetOperations<String, String> boundZSetOperations = orderingTemplate.boundZSetOps(orderingKey);
    final long amount = boundZSetOperations.size();
    final Set<String> valueIds = boundZSetOperations.range(0, max(0, min(amount, batchMaxSize) - 1));
    return valueIds.stream()
            .map(id -> getOps(id))
            .filter(Objects::nonNull)
            .collect(Collectors.toSet());
}
 
开发者ID:ozimov,项目名称:spring-boot-email-tools,代码行数:12,代码来源:DefaultPersistenceService.java

示例7: boundZSetOps

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
@Override
public BoundZSetOperations<K, V> boundZSetOps(K key) {
	try {
		return redisTemplate.boundZSetOps(key);
	} catch (Exception ex) {
		throw new RedisBaoException(ex);
	}
}
 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:9,代码来源:RedisBaoSupporter.java

示例8: getUserSet

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
public BoundZSetOperations<String, String> getUserSet() {
    return redisTemplate.boundZSetOps(onlineUserListKey);
}
 
开发者ID:ctodb,项目名称:push,代码行数:4,代码来源:UserManager.java

示例9: boundZSetOps

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
@Override
public BoundZSetOperations<K, V> boundZSetOps(K key) {
	throw new MethodNotSupportException("myRedisTemplate not support this method : boundZSetOps(K key) , please use opsForXX");
	//return new DefaultBoundZSetOperations<K, V>(key, this);
}
 
开发者ID:mauersu,项目名称:redis-admin,代码行数:6,代码来源:MyRedisTemplate.java

示例10: checkDeliveredMessages

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
/**
 * Finds message IDs in the Redis store for which no response from consumers
 * has arrived since the configured timeout value
 */
@Scheduled(fixedRateString="${consistemncy.checker.rate:1000}")
public void checkDeliveredMessages() {
	if( redisTemplate == null ) {
		return;
	}
	
	try {
		for(int i=0; i<numPublishers; i++) {

			Date checkTime = new Date();
			long checkTimeLong = checkTime.getTime();
			long checkSince = checkTimeLong - timeSince;

			BoundZSetOperations<String, Long> publishedZSetOps = redisTemplate.boundZSetOps(utils.getPublishedZKey(i));
			BoundSetOperations<String, Long> publishedSetOps = redisTemplate.boundSetOps(utils.getPublishedKey(i));

			// Get the ids of the messages published longer than timeout to 
			// wait for their reception
			Set<Long> oldPublishedIds = publishedZSetOps.rangeByScore(0, checkSince);
			Set<Long> oldUnrespondedIds = new HashSet<>( oldPublishedIds );

			for(int j=0; j<numConsumers; j++) {
								
				log.debug("Checking messages published by {} at {} {} ({}) since ({})", 
						utils.getPublishedKey(i), utils.getReceivedKey(j), checkTime, checkTimeLong, checkSince);
		
				
				BoundSetOperations<String, Long> receivedSetOps = redisTemplate.boundSetOps(utils.getReceivedKey(j));
						
				// Get the Set difference between all published ID minus all responded ids
				Set<Long> unresponded = publishedSetOps.diff( utils.getReceivedKey(j) );
				
				// Filter out recent IDs for which the timeout hasn't fired yet
				oldUnrespondedIds.retainAll(unresponded);
				
				if( !oldUnrespondedIds.isEmpty() ) {
					log.error("NO RESPONSE in {} FOR {} MESSAGES: {}", 
							utils.getReceivedKey(j), utils.getPublishedKey(i), oldPublishedIds);
				}
				
				// Clean old checked records
				receivedSetOps.remove(oldPublishedIds);
				
			}

			publishedZSetOps.removeRangeByScore(0, checkSince);
			publishedSetOps.remove(oldPublishedIds);
		}
	}
	catch(Exception ex) {
		log.warn("Consistency could not be checked: {}", ex.getMessage());
	}
	
}
 
开发者ID:sshcherbakov,项目名称:cf-service-tester,代码行数:59,代码来源:ConsistencyChecker.java

示例11: boundZSetOps

import org.springframework.data.redis.core.BoundZSetOperations; //导入依赖的package包/类
BoundZSetOperations<K, V> boundZSetOps(K key); 
开发者ID:mixaceh,项目名称:openyu-commons,代码行数:2,代码来源:RedisBao.java


注:本文中的org.springframework.data.redis.core.BoundZSetOperations类示例由纯净天空整理自Github/MSDocs等开源代码及文档管理平台,相关代码片段筛选自各路编程大神贡献的开源项目,源码版权归原作者所有,传播和使用请参考对应项目的License;未经允许,请勿转载。