use of com.creditease.uav.feature.runtimenotify.Slice in project uavstack by uavorg.
the class DoTestLoadRuntimeSliceData method loadSlices.
public static void loadSlices(long range, String key, CacheManager cm) {
long end = System.currentTimeMillis();
long start = end - range * 1000;
int cacheLen = cm.llen("store.region.uav", key);
System.out.println("len:" + cacheLen);
List<Slice> list = new ArrayList<>();
for (int index = cacheLen - 1; index > 0; index--) {
String sj = cm.lindex("store.region.uav", key, index);
Slice r = new Slice(sj);
if (r.getTime() <= end && r.getTime() >= start) {
list.add(r);
continue;
}
if (r.getTime() < start) {
break;
}
}
Collections.reverse(list);
System.out.println("sellen:" + list.size());
for (Slice slice : list) {
System.out.println(JSONHelper.toString(slice));
}
}
Aggregations