• 设为首页
  • 点击收藏
  • 手机版
    手机扫一扫访问
    迪恩网络手机版
  • 关注官方公众号
    微信扫一扫关注
    迪恩网络公众号

Java ScanOptions类代码示例

原作者: [db:作者] 来自: [db:来源] 收藏 邀请

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



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

示例1: findSignUpCodeByUsername

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public UUID findSignUpCodeByUsername(String username) {
    String foundSignUpCodeKey = redisTemplate.execute(new RedisCallback<String>() {
        @Override
        public String doInRedis(RedisConnection connection) throws DataAccessException {
            try (Cursor<byte[]> cursor = connection.scan(
                    ScanOptions.scanOptions().match("signup:signupcode*").build())) {
                while (cursor.hasNext()) {
                    String key = new String(cursor.next(), "UTF-8");
                    String usernameFromRedis = (String) redisTemplate.opsForHash().get(key, "username");
                    if (username.equals(usernameFromRedis)) {
                        return key;
                    }
                }
            } catch (IOException e) {
                throw new FlexPokerException("error in Redis");
            }
            throw new FlexPokerException("could not find username in Redis");
        }
    });

    return UUID.fromString(foundSignUpCodeKey.split(":")[2]);
}
 
开发者ID:cwoolner,项目名称:flex-poker,代码行数:24,代码来源:RedisSignUpRepository.java


示例2: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的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: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<V> scan(K key, final ScanOptions options) {

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

		@Override
		public Cursor<V> doInRedis(RedisConnection connection) throws DataAccessException {
			return new ConvertingCursor<byte[], V>(connection.sScan(rawKey, options), new Converter<byte[], V>() {

				@Override
				public V convert(byte[] source) {
					return deserializeValue(source);
				}
			});
		}
	}, true);

}
 
开发者ID:mauersu,项目名称:redis-admin,代码行数:20,代码来源:DefaultSetOperations.java


示例4: clear

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@ManagedOperation(description = "Clear the store")
@Override
public void clear() {
    valueOperations.getOperations().execute(new RedisCallback<List<byte[]>>() {
        @Override
        public List<byte[]> doInRedis(RedisConnection connection) throws DataAccessException {
            List<byte[]> binaryKeys = new ArrayList<>();
            Cursor<byte[]> cursor = connection.scan(ScanOptions.scanOptions().match("*" + createRedisKey("*")).build());

            while (cursor.hasNext()) {
                byte[] key = cursor.next();
                binaryKeys.add(key);
            }
            if (binaryKeys.size() > 0) {
                connection.del(binaryKeys.toArray(new byte[][]{}));
            }
            return binaryKeys;
        }
    });
}
 
开发者ID:HydAu,项目名称:Camel,代码行数:21,代码来源:RedisStringIdempotentRepository.java


示例5: iterateOverKeysMatchingPrefixUsingScanCommand

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
/**
 * Uses {@code SCAN} command for loading all matching keys. <br />
 * {@code SCAN} uses a cursor on server side returning only a subset of the available data with the possibility to
 * ripple load further elements using the cursors position. <br />
 * All keys will be loaded using <strong>multiple</strong> operations.
 */
@Test
public void iterateOverKeysMatchingPrefixUsingScanCommand() {

	generateRandomKeys(1000);

	Cursor<byte[]> cursor = this.connection.scan(ScanOptions.scanOptions().match(KEY_PATTERN).build());
	printKeys(cursor);
}
 
开发者ID:Just-Fun,项目名称:spring-data-examples,代码行数:15,代码来源:KeyOperationsTests.java


示例6: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Entry<HK, HV>> scan(K key, final ScanOptions options) {

	final byte[] rawKey = rawKey(key);
	return execute(new RedisCallback<Cursor<Map.Entry<HK, HV>>>() {

		@Override
		public Cursor<Entry<HK, HV>> doInRedis(RedisConnection connection) throws DataAccessException {

			return new ConvertingCursor<Map.Entry<byte[], byte[]>, Map.Entry<HK, HV>>(connection.hScan(rawKey, options),
					new Converter<Map.Entry<byte[], byte[]>, Map.Entry<HK, HV>>() {

						@Override
						public Entry<HK, HV> convert(final Entry<byte[], byte[]> source) {

							return new Map.Entry<HK, HV>() {

								@Override
								public HK getKey() {
									return deserializeHashKey(source.getKey());
								}

								@Override
								public HV getValue() {
									return deserializeHashValue(source.getValue());
								}

								@Override
								public HV setValue(HV value) {
									throw new UnsupportedOperationException("Values cannot be set when scanning through entries.");
								}
							};

						}
					});
		}

	}, true);

}
 
开发者ID:mauersu,项目名称:redis-admin,代码行数:41,代码来源:DefaultHashOperations.java


示例7: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Entry<Object, Object>> scan(String key, ScanOptions options) {
	throw new UnsupportedOperationException("Unsupported method");
}
 
开发者ID:davidgamez,项目名称:parrot-rest,代码行数:5,代码来源:HashOperationsMock.java


示例8: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<byte[]> scan(ScanOptions options) {
    return redisConnection.scan(options);
}
 
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java


示例9: sScan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<byte[]> sScan(byte[] key, ScanOptions options) {
    return redisConnection.sScan(key, options);
}
 
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java


示例10: zScan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Tuple> zScan(byte[] key, ScanOptions options) {
    return redisConnection.zScan(key, options);
}
 
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java


示例11: hScan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Map.Entry<byte[], byte[]>> hScan(byte[] key, ScanOptions options) {
    return redisConnection.hScan(key, options);
}
 
开发者ID:1991wangliang,项目名称:tx-lcn,代码行数:5,代码来源:AbstractRedisConnection.java


示例12: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<V> scan(ScanOptions options) {
	return ops.scan(getKey(), options);
}
 
开发者ID:mauersu,项目名称:redis-admin,代码行数:5,代码来源:DefaultBoundSetOperations.java


示例13: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<Entry<HK, HV>> scan(ScanOptions options) {
	return ops.scan(getKey(), options);
}
 
开发者ID:mauersu,项目名称:redis-admin,代码行数:5,代码来源:DefaultBoundHashOperations.java


示例14: scan

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
@Override
public Cursor<TypedTuple<V>> scan(ScanOptions options) {
	return ops.scan(getKey(), options);
}
 
开发者ID:mauersu,项目名称:redis-admin,代码行数:5,代码来源:DefaultBoundZSetOperations.java


示例15: getStartOptions

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
/**
 * 前缀
 * @param prefix
 * @return
 * @since  1.0
 */
public static ScanOptions getStartOptions(String prefix) {
    return ScanOptions.scanOptions().match("^" + prefix + ".*").build();
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:10,代码来源:RedisKeys.java


示例16: getEndOptions

import org.springframework.data.redis.core.ScanOptions; //导入依赖的package包/类
/**
 * 后缀
 * @param suffix
 * @return
 * @since  1.0
 */
public static ScanOptions getEndOptions(String suffix) {
    return ScanOptions.scanOptions().match(".*" + suffix + "$").build();
}
 
开发者ID:ccfish86,项目名称:sctalk,代码行数:10,代码来源:RedisKeys.java



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


鲜花

握手

雷人

路过

鸡蛋
该文章已有0人参与评论

请发表评论

全部评论

专题导读
上一篇:
Java DefaultFillFormatter类代码示例发布时间:2022-05-22
下一篇:
Java BlacklistedDirectories类代码示例发布时间:2022-05-22
热门推荐
阅读排行榜

扫描微信二维码

查看手机版网站

随时了解更新最新资讯

139-2527-9053

在线客服(服务时间 9:00~18:00)

在线QQ客服
地址:深圳市南山区西丽大学城创智工业园
电邮:jeky_zhao#qq.com
移动电话:139-2527-9053

Powered by 互联科技 X3.4© 2001-2213 极客世界.|Sitemap