@Test public void testAddField() { Jedis jedis = pool.getResource(); jedis.auth(password); try { ManagerPersistHash managerPersistHash = new ManagerPersistHash(jedis, KEY_NAME, MAX_SPAN_TIME); managerPersistHash.addFields(FIELDS); List<String> fields = managerPersistHash.getFields(); for (String field : fields) { boolean flag = Boolean.FALSE; for (String f : FIELDS) { if (field.equals(f)) { flag = Boolean.TRUE; } } assertTrue(flag); } jedis.del(KEY_NAME); } finally { pool.returnResource(jedis); } }
@Override public void addField(String field) { try { jedis.hset(keyName, field, System.currentTimeMillis() + ""); } catch (Exception e) { logger.error("Exception:{}", LogbackUtil.expection2Str(e)); } }
ManagerPersistHash implements ManagerHash { @Override public void addField(String field) { try { jedis.hset(keyName, field, System.currentTimeMillis() + ""); } catch (Exception e) { logger.error("Exception:{}", LogbackUtil.expection2Str(e)); } } }
ManagerPersistHash implements ManagerHash { @Override public void addField(String field) { try { jedis.hset(keyName, field, System.currentTimeMillis() + ""); } catch (Exception e) { logger.error("Exception:{}", LogbackUtil.expection2Str(e)); } } ManagerPersistHash(Jedis jedis, String keyName, long maxSpanTime); }
ManagerPersistHash implements ManagerHash { @Override public void addField(String field) { try { jedis.hset(keyName, field, System.currentTimeMillis() + ""); } catch (Exception e) { logger.error("Exception:{}", LogbackUtil.expection2Str(e)); } } ManagerPersistHash(Jedis jedis, String keyName, long maxSpanTime); @Override void addField(String field); @Override void addFields(String... fields); @Override boolean isExisted(String field); @Override void delFields(); @Override List<String> getFields(); }
ManagerPersistHash implements ManagerHash { @Override public void addField(String field) { try { jedis.hset(keyName, field, System.currentTimeMillis() + ""); } catch (Exception e) { logger.error("Exception:{}", LogbackUtil.expection2Str(e)); } } ManagerPersistHash(Jedis jedis, String keyName, long maxSpanTime); @Override void addField(String field); @Override void addFields(String... fields); @Override boolean isExisted(String field); @Override void delFields(); @Override List<String> getFields();  }