@Test public void size() throws Exception { String head = "sizeA"; RList list = db.getList(); int num = 10 * 10000; try { JoinFuture<String> joinFuture = JoinFuture.build(executorService, String.class); for (int i = 0; i < num; i++) { int fj = i; joinFuture.add(args -> { try { list.add(head, ("hello" + fj).getBytes()); } catch (Exception e) { e.printStackTrace(); } return ""; }); } joinFuture.join(); Assert.assertEquals(num, list.size(head)); int remove_num = 0; int[] nums = TestUtil.randomArray(1, 123, 100); for (int i : nums) { list.blpop(head, i); remove_num = remove_num + i; } Assert.assertEquals(num - remove_num, list.size(head)); } finally { list.delete(head); } Assert.assertEquals(0, list.size(head)); }
public int size(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); MetaV metaV = getMeta(key_b); if (metaV == null) { return 0; } return metaV.getSize(); } }
RList extends RCollection { public int size(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); MetaV metaV = getMeta(key_b); if (metaV == null) { return 0; } return metaV.getSize(); } } }
RList extends RCollection { public int size(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); MetaV metaV = getMeta(key_b); if (metaV == null) { return 0; } return metaV.getSize(); } } protected  RList(DB db); }
RList extends RCollection { public int size(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); MetaV metaV = getMeta(key_b); if (metaV == null) { return 0; } return metaV.getSize(); } } protected  RList(DB db); void add(String key, byte[] v); void addAll(String key, List<byte[]> vs); void addAllMayTTL(String key, List<byte[]> vs, int ttl); void set(String key, long i, byte[] v); byte[] get(String key, long i); List<byte[]> get(String key, List<Long> is); Long left(String key); Long right(String key); int size(String key); void deleteFast(String key); void delete(String key); boolean isExist(String key); List<byte[]> range(String key, long start, long end); @Override @SuppressWarnings("unchecked") RIterator<RList> iterator(String key); Entry getEntry(RocksIterator iterator); List<byte[]> blpop(String key, int num); List<byte[]> brpop(String key, int num); @Override KeyIterator getKeyIterator(); void ttl(String key, int ttl); void delTtl(String key); int getTtl(String key); void addMayTTL(String key, byte[] v, int ttl); }
RList extends RCollection { public int size(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); MetaV metaV = getMeta(key_b); if (metaV == null) { return 0; } return metaV.getSize(); } } protected  RList(DB db); void add(String key, byte[] v); void addAll(String key, List<byte[]> vs); void addAllMayTTL(String key, List<byte[]> vs, int ttl); void set(String key, long i, byte[] v); byte[] get(String key, long i); List<byte[]> get(String key, List<Long> is); Long left(String key); Long right(String key); int size(String key); void deleteFast(String key); void delete(String key); boolean isExist(String key); List<byte[]> range(String key, long start, long end); @Override @SuppressWarnings("unchecked") RIterator<RList> iterator(String key); Entry getEntry(RocksIterator iterator); List<byte[]> blpop(String key, int num); List<byte[]> brpop(String key, int num); @Override KeyIterator getKeyIterator(); void ttl(String key, int ttl); void delTtl(String key); int getTtl(String key); void addMayTTL(String key, byte[] v, int ttl); final static String HEAD; final static byte[] HEAD_VALUE_B; final static byte[] HEAD_B; }