use of info.xiancloud.core.support.cache.vo.ScanVo in project xian by happyyangyuan.
the class ObjectApi method scan.
@Test
public void scan() {
String pattern = "*";
int count = 10;
String cursor = ScanVo.CURSOR_START_END;
ScanVo scanVo = CacheObjectUtil.scan(pattern, count, cursor);
while (scanVo != null) {
List<String> keys = scanVo.getResult();
System.out.println("游标: " + scanVo.getCursor() + ", 匹配数量: " + keys.size());
keys.stream().forEach(key -> System.out.println(key));
if (scanVo.isEndIteration())
return;
System.out.println("下一轮起始游标: " + scanVo.getCursor());
scanVo = CacheObjectUtil.scan(pattern, count, scanVo.getCursor());
}
}
use of info.xiancloud.core.support.cache.vo.ScanVo in project xian by happyyangyuan.
the class CacheObjectUtil method scan.
/**
* @param cacheConfigBean cacheConfigBean
* @param pattern pattern
* @param count count
* @param cursor cursor
* @return ScanVo
* @deprecated 不建议使用该 API, 各种不稳定
*/
public static ScanVo scan(CacheConfigBean cacheConfigBean, String pattern, int count, String cursor) {
UnitResponse unitResponseObject = SyncXian.call(CacheService.CACHE_SERVICE, "cacheScan", new JSONObject() {
{
put("cacheConfig", cacheConfigBean);
put("pattern", pattern);
put("count", count);
put("cursor", cursor);
}
});
unitResponseObject.throwExceptionIfNotSuccess();
JSONObject jsonObject = unitResponseObject.getData();
return new ScanVo(jsonObject);
}
Aggregations