function writeLength (stream, length) {
  var buffer = lengthCache[length]

  if (!buffer) {
    buffer = genBufLength(length)
    if (length < 16384) lengthCache[length] = buffer
  }

  stream.write(buffer)
}
writeLength - write an MQTT style length field to the buffer

@param <Buffer> buffer - destination
@param <Number> pos - offset
@param <Number> length - length (>0)
@returns <Number> number of bytes written

@api private