### Question:
RSet extends RCollection { @Override public int getTtl(String key) throws KitDBException { try (CloseLock ignored = checkClose()) { byte[] key_b = getKey(key); MetaV metaV = getMeta(key_b); if (metaV == null) { return -1; } if (metaV.getTimestamp() == -1) { return -1; } return (int) (metaV.getTimestamp() - System.currentTimeMillis() / 1000); } } 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; }### Answer:
@Test public void getTtl() throws KitDBException, InterruptedException { String head = "getTtl"; RSet set = db.getSet(); int num = 10000; try { for (int i = 0; i < num; i++) { set.add(head, ("hello world" + i).getBytes()); } Assert.assertEquals(-1, set.getTtl(head)); set.ttl(head, 10); Assert.assertTrue(set.getTtl(head) > 9); Assert.assertTrue(set.getTtl(head) != 0); Thread.sleep(10000); } finally { } }