set

写单行数据

  1. /**
  2. * Set Value
  3. * @param {String} tableName
  4. * @param {Object} args
  5. * {Buffer} args.hashKey required
  6. * {Buffer} args.sortKey required
  7. * {Buffer} args.value required
  8. * {Number} args.ttl(s) optional
  9. * {Number} args.timeout(ms) optional
  10. * @param {Function} callback
  11. * @throws{InvalidParamException} callback is not function
  12. */
  13. client.set(
  14. tableName,
  15. args,
  16. function(err){
  17. // if set operation succeed, err will be null
  18. // else err will be instance of PException
  19. }
  20. );
  • set操作的必填参数有表名,hashKey,sortKey,value和callback
  • ttl的含义为过期时间,单位为秒,默认ttl为0,则表示该数据不过期,若用户设置ttl为86400s,则表示该数据将在1天之后过期,用户在1天之后将无法读取到该数据