@Test public void add() throws KitDBException { String head = "add0"; RSet set = db.getSet(); int num = 10 * 10000; try { for (int i = 0; i < num; i++) { set.add(head, ("hello world" + i).getBytes()); } for (int i = 0; i < num; i++) { Assert.assertTrue(set.contains(head, ("hello world" + i).getBytes())); } Assert.assertEquals(num, set.size(head)); } finally { set.delete(head); } try { JoinFuture<String> joinFuture = JoinFuture.build(executorService, String.class); for (int i = 0; i < num; i++) { int fj = i; joinFuture.add(args -> { try { set.add(head, ("hello world" + fj).getBytes()); } catch (Exception e) { e.printStackTrace(); } return ""; }); } joinFuture.join(); for (int i = 0; i < num; i++) { Assert.assertTrue(set.contains(head, ("hello world" + i).getBytes())); } Assert.assertEquals(num, set.size(head)); } finally { set.delete(head); } }
public void add(String key, byte[]... values) throws KitDBException { addMayTTL(key, -1, values); }
RSet extends RCollection { public void add(String key, byte[]... values) throws KitDBException { addMayTTL(key, -1, values); } }
RSet extends RCollection { public void add(String key, byte[]... values) throws KitDBException { addMayTTL(key, -1, values); } protected  RSet(DB db); }
RSet extends RCollection { public void add(String key, byte[]... values) throws KitDBException { addMayTTL(key, -1, values); } protected  RSet(DB db); List<byte[]> pop(String key, int num); void remove(String key, byte[]... values); boolean contains(String key, byte[] value); void addMayTTL(String key, int ttl, byte[]... values); void add(String key, byte[]... values); @Override void delete(String key); @Override KeyIterator getKeyIterator(); void deleteFast(String key); @Override @SuppressWarnings("unchecked") RIterator<RSet> iterator(String key); @Override int getTtl(String key); @Override void delTtl(String key); @Override void ttl(String key, int ttl); @Override boolean isExist(String key); @Override int size(String key); @Override Entry getEntry(RocksIterator iterator); }
RSet extends RCollection { public void add(String key, byte[]... values) throws KitDBException { addMayTTL(key, -1, values); } protected  RSet(DB db); List<byte[]> pop(String key, int num); void remove(String key, byte[]... values); boolean contains(String key, byte[] value); void addMayTTL(String key, int ttl, byte[]... values); void add(String key, byte[]... values); @Override void delete(String key); @Override KeyIterator getKeyIterator(); void deleteFast(String key); @Override @SuppressWarnings("unchecked") RIterator<RSet> iterator(String key); @Override int getTtl(String key); @Override void delTtl(String key); @Override void ttl(String key, int ttl); @Override boolean isExist(String key); @Override int size(String key); @Override Entry getEntry(RocksIterator iterator); final static String HEAD; final static byte[] HEAD_B; final static byte[] HEAD_V_B; }