set

写单行数据。

  1. /**
  2. * Set value.
  3. * @param tableName TableHandler name
  4. * @param hashKey used to decide which partition to put this k-v,
  5. * if null or length == 0, means hash key is "".
  6. * @param sortKey all the k-v under hashKey will be sorted by sortKey,
  7. * if null or length == 0, means sort key is "".
  8. * @param value should not be null
  9. * @param ttl_seconds time to live in seconds,
  10. * 0 means no ttl. default value is 0.
  11. * @throws PException
  12. */
  13. public void set(String tableName, byte[] hashKey, byte[] sortKey, byte[] value, int ttl_seconds) throws PException;
  14. public void set(String tableName, byte[] hashKey, byte[] sortKey, byte[] value) throws PException;

注:

  • 提供了两个版本的接口,其中第一个接口可以指定TTL时间。
  • 参数:需传入TableName、HashKey、SortKey、value;选择性传入TTL。
  • 返回值:无。
  • 异常:如果出现异常,譬如网络错误、超时错误、服务端错误等,会抛出 PException。