@Override
  public void saveConceptRelation(int catId, int conceptId) {
    byte[] key = (prefix + "id2aids").getBytes(ENCODING);
    byte[] hkey = NumberUtils.int2Bytes(catId);
    byte[] value = jedis.hget(key, hkey);
    Set<Integer> ids = NumberUtils.bytes2IntSet(value);

    if (!ids.contains(conceptId)) {
      ids.add(conceptId);
      jedis.hset(key, hkey, NumberUtils.intSet2Bytes(ids));
    }

    // 记录该类别下概念的数量
    incConceptCount(catId, 1);

    // 记录概念所隶属的类别
    key = (prefix + "ctp:catids").getBytes(ENCODING);
    hkey = NumberUtils.int2Bytes(conceptId);
    value = jedis.hget(key, hkey);
    ids = NumberUtils.bytes2IntSet(value);
    if (!ids.contains(catId)) {
      ids.add(catId);
      jedis.hset(key, hkey, NumberUtils.intSet2Bytes(ids));
    }
  }
  private void saveChildren(int catId, int... childIds) {
    byte[] key = (prefix + "id2cids").getBytes(ENCODING);
    byte[] hkey = NumberUtils.int2Bytes(catId);
    byte[] value = jedis.hget(key, hkey);
    Set<Integer> ids = NumberUtils.bytes2IntSet(value);

    boolean changed = false;
    for (int id : childIds) {
      if (idExist(id) && !ids.contains(id)) {
        ids.add(id);
        changed = true;
      }
    }
    if (changed) jedis.hset(key, hkey, NumberUtils.intSet2Bytes(ids));
  }
  private void saveParents(int catId, int... parentIds) {
    byte[] key = (prefix + "id2pids").getBytes(ENCODING);
    byte[] hkey = NumberUtils.int2Bytes(catId);

    byte[] value = jedis.hget(key, hkey);
    Set<Integer> ids = NumberUtils.bytes2IntSet(value);

    boolean changed = false;
    for (int p : parentIds) {
      if (idExist(p)) {
        ids.add(p);
        changed = true;
      }
    }
    if (changed) jedis.hset(key, hkey, NumberUtils.intSet2Bytes(ids));
  }
  private void saveParents(int catId, Collection<String> parents) {
    byte[] key = (prefix + "id2pids").getBytes(ENCODING);
    byte[] hkey = NumberUtils.int2Bytes(catId);

    byte[] value = jedis.hget(key, hkey);
    Set<Integer> ids = NumberUtils.bytes2IntSet(value);

    boolean changed = false;
    for (String p : parents) {
      if (nameExist(p)) {
        try {
          ids.add(getIdByName(p));
          changed = true;
        } catch (MissedException e) {
          LOG.warn(e.toString());
        }
      }
    }
    if (changed) jedis.hset(key, hkey, NumberUtils.intSet2Bytes(ids));
  }
  private void saveChildren(int catId, String... children) {
    byte[] key = (prefix + "id2cids").getBytes(ENCODING);
    byte[] hkey = NumberUtils.int2Bytes(catId);

    byte[] value = jedis.hget(key, hkey);
    Set<Integer> ids = NumberUtils.bytes2IntSet(value);

    boolean changed = false;
    for (String c : children) {
      if (nameExist(c)) {
        try {
          ids.add(getIdByName(c));
          changed = true;
        } catch (MissedException e) {
          e.printStackTrace();
        }
      }
    }
    if (changed) jedis.hset(key, hkey, NumberUtils.intSet2Bytes(ids));
  }