當前位置: 首頁>>代碼示例>>Java>>正文


Java Tuple類代碼示例

本文整理匯總了Java中org.springframework.data.redis.connection.RedisZSetCommands.Tuple的典型用法代碼示例。如果您正苦於以下問題:Java Tuple類的具體用法?Java Tuple怎麽用?Java Tuple使用的例子?那麽, 這裏精選的類代碼示例或許可以為您提供幫助。


Tuple類屬於org.springframework.data.redis.connection.RedisZSetCommands包,在下文中一共展示了Tuple類的15個代碼示例,這些例子默認根據受歡迎程度排序。您可以為喜歡或者感覺有用的代碼點讚,您的評價將有助於係統推薦出更棒的Java代碼示例。

示例1: rawTupleValues

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
@SuppressWarnings("unchecked")
Set<Tuple> rawTupleValues(Set<TypedTuple<V>> values) {
	if (values == null) {
		return null;
	}
	Set<Tuple> rawTuples = new LinkedHashSet<Tuple>(values.size());
	for (TypedTuple<V> value : values) {
		byte[] rawValue;
		if (valueSerializer() == null && value.getValue() instanceof byte[]) {
			rawValue = (byte[]) value.getValue();
		} else {
			rawValue = valueSerializer().serialize(value.getValue());
		}
		rawTuples.add(new DefaultTuple(rawValue, value.getScore()));
	}
	return rawTuples;
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:18,代碼來源:AbstractOperations.java

示例2: scan

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
@Override
public Cursor<TypedTuple<V>> scan(K key, final ScanOptions options) {

	final byte[] rawKey = rawKey(key);
	Cursor<Tuple> cursor = execute(new RedisCallback<Cursor<Tuple>>() {

		@Override
		public Cursor<Tuple> doInRedis(RedisConnection connection) throws DataAccessException {
			connection.select(dbIndex);
			return connection.zScan(rawKey, options);
		}
	}, true);

	return new ConvertingCursor<Tuple, TypedTuple<V>>(cursor, new Converter<Tuple, TypedTuple<V>>() {

		@Override
		public TypedTuple<V> convert(Tuple source) {
			return deserializeTuple(source);
		}
	});
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:22,代碼來源:DefaultZSetOperations.java

示例3: zRevRangeByScoreWithScore

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public <K, V> Set<TypedTuple<V>> zRevRangeByScoreWithScore(K key, double min,
                                                           double max, long limit, long skip, Class<V> classNm) {
    NaviShardJedisDriver driver = getDriver();
    try {
        Set<Tuple> set = limit > 0 ? driver.zRevRangeByScoreWithScores(
            object2Bytes(key), min, max, skip, limit) : driver
            .zRevRangeByScoreWithScores(object2Bytes(key), min, max);
        Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
        for (Tuple t : set) {
            result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
                classNm), t.getScore()));
        }
        return result;
    } finally {
        driver.close();
    }
}
 
開發者ID:sunguangran,項目名稱:navi,代碼行數:18,代碼來源:NaviShardedJedisService.java

示例4: zRangeByScoreWithScore

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public <K, V> Set<TypedTuple<V>> zRangeByScoreWithScore(K key, double min,
                                                        double max, long limit, long skip, Class<V> classNm) {
    NaviShardJedisDriver driver = getDriver();
    try {
        Set<Tuple> set = limit > 0 ? driver.zRangeByScoreWithScores(
            object2Bytes(key), min, max, skip, limit) : driver
            .zRangeByScoreWithScores(object2Bytes(key), min, max);
        Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
        for (Tuple t : set) {
            result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
                classNm), t.getScore()));
        }
        return result;
    } finally {
        driver.close();
    }
}
 
開發者ID:sunguangran,項目名稱:navi,代碼行數:18,代碼來源:NaviShardedJedisService.java

示例5: zadd

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
@Override
public long zadd(final byte[] key, final Set<Tuple> tuples) {
	redisTemplate.execute(new RedisCallback<Long>() {

		@Override
		public Long doInRedis(RedisConnection connection) throws DataAccessException {
			return connection.zAdd(key, tuples);
		}
	});
	return 0;
}
 
開發者ID:javahongxi,項目名稱:whatsmars,代碼行數:12,代碼來源:RedisSortedSetServiceImpl.java

示例6: deserializeTupleValues

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
Set<TypedTuple<V>> deserializeTupleValues(Collection<Tuple> rawValues) {
	if (rawValues == null) {
		return null;
	}
	Set<TypedTuple<V>> set = new LinkedHashSet<TypedTuple<V>>(rawValues.size());
	for (Tuple rawValue : rawValues) {
		set.add(deserializeTuple(rawValue));
	}
	return set;
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:11,代碼來源:AbstractOperations.java

示例7: deserializeTuple

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
@SuppressWarnings({ "unchecked", "rawtypes" })
TypedTuple<V> deserializeTuple(Tuple tuple) {
	Object value = tuple.getValue();
	if (valueSerializer() != null) {
		value = valueSerializer().deserialize(tuple.getValue());
	}
	return new DefaultTypedTuple(value, tuple.getScore());
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:9,代碼來源:AbstractOperations.java

示例8: add

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public Long add(K key, Set<TypedTuple<V>> tuples) {
	final byte[] rawKey = rawKey(key);
	final Set<Tuple> rawValues = rawTupleValues(tuples);

	return execute(new RedisCallback<Long>() {

		public Long doInRedis(RedisConnection connection) {
			connection.select(dbIndex);
			return connection.zAdd(rawKey, rawValues);
		}
	}, true);
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:13,代碼來源:DefaultZSetOperations.java

示例9: rangeWithScores

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public Set<TypedTuple<V>> rangeWithScores(K key, final long start, final long end) {
	final byte[] rawKey = rawKey(key);

	Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {

		public Set<Tuple> doInRedis(RedisConnection connection) {
			connection.select(dbIndex);
			return connection.zRangeWithScores(rawKey, start, end);
		}
	}, true);

	return deserializeTupleValues(rawValues);
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:14,代碼來源:DefaultZSetOperations.java

示例10: reverseRangeWithScores

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public Set<TypedTuple<V>> reverseRangeWithScores(K key, final long start, final long end) {
	final byte[] rawKey = rawKey(key);

	Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {

		public Set<Tuple> doInRedis(RedisConnection connection) {
			connection.select(dbIndex);
			return connection.zRevRangeWithScores(rawKey, start, end);
		}
	}, true);

	return deserializeTupleValues(rawValues);
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:14,代碼來源:DefaultZSetOperations.java

示例11: rangeByScoreWithScores

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public Set<TypedTuple<V>> rangeByScoreWithScores(K key, final double min, final double max) {
	final byte[] rawKey = rawKey(key);

	Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {

		public Set<Tuple> doInRedis(RedisConnection connection) {
			connection.select(dbIndex);
			return connection.zRangeByScoreWithScores(rawKey, min, max);
		}
	}, true);

	return deserializeTupleValues(rawValues);
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:14,代碼來源:DefaultZSetOperations.java

示例12: reverseRangeByScoreWithScores

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public Set<TypedTuple<V>> reverseRangeByScoreWithScores(K key, final double min, final double max) {
	final byte[] rawKey = rawKey(key);

	Set<Tuple> rawValues = execute(new RedisCallback<Set<Tuple>>() {

		public Set<Tuple> doInRedis(RedisConnection connection) {
			connection.select(dbIndex);
			return connection.zRevRangeByScoreWithScores(rawKey, min, max);

		}
	}, true);

	return deserializeTupleValues(rawValues);
}
 
開發者ID:mauersu,項目名稱:redis-admin,代碼行數:15,代碼來源:DefaultZSetOperations.java

示例13: zRangeWithScore

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public <K, V> Set<TypedTuple<V>> zRangeWithScore(K key, long start,
                                                 long end, Class<V> classNm) {
    NaviShardJedisDriver driver = getDriver();
    try {
        Set<Tuple> set = driver.zRangeWithScores(object2Bytes(key), start, end);
        Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
        for (Tuple t : set) {
            result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
                classNm), t.getScore()));
        }
        return result;
    } finally {
        driver.close();
    }
}
 
開發者ID:sunguangran,項目名稱:navi,代碼行數:16,代碼來源:NaviShardedJedisService.java

示例14: zReverseRangeWithScore

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public <K, V> Set<TypedTuple<V>> zReverseRangeWithScore(K key, long start,
                                                        long end, Class<V> classNm) {
    NaviShardJedisDriver driver = getDriver();
    try {
        Set<Tuple> set = driver.zRevRangeWithScores(object2Bytes(key), start, end);
        Set<TypedTuple<V>> result = new LinkedHashSet<TypedTuple<V>>();
        for (Tuple t : set) {
            result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(),
                classNm), t.getScore()));
        }
        return result;
    } finally {
        driver.close();
    }
}
 
開發者ID:sunguangran,項目名稱:navi,代碼行數:16,代碼來源:NaviShardedJedisService.java

示例15: zRevRangeByScoreWithScore

import org.springframework.data.redis.connection.RedisZSetCommands.Tuple; //導入依賴的package包/類
public <K, V> Set<TypedTuple<V>> zRevRangeByScoreWithScore(K key, double min, double max, long limit, long skip, Class<V> classNm) {
    AbstractNaviPoolJedisDriver driver = getDriver();
    Set<Tuple> set = limit > 0 ? driver.zRevRangeByScoreWithScores(
        object2Bytes(key), min, max, skip, limit) : driver.zRevRangeByScoreWithScores(object2Bytes(key), min, max
    );
    Set<TypedTuple<V>> result = new LinkedHashSet<>();
    for (Tuple t : set) {
        result.add(new DefaultTypedTuple<V>(bytes2Object(t.getValue(), classNm), t.getScore()));
    }
    return result;
}
 
開發者ID:sunguangran,項目名稱:navi,代碼行數:12,代碼來源:NaviPooledShardedJedisService.java


注:本文中的org.springframework.data.redis.connection.RedisZSetCommands.Tuple類示例由純淨天空整理自Github/MSDocs等開源代碼及文檔管理平台,相關代碼片段篩選自各路編程大神貢獻的開源項目,源碼版權歸原作者所有,傳播和使用請參考對應項目的License;未經允許,請勿轉載。