minio / minio-cpp

MinIO C++ Client SDK for Amazon S3 Compatible Cloud Storage
https://minio-cpp.min.io/
Apache License 2.0
139 stars 56 forks source link

how and should set client to a local var? #168

Closed miniboxhaha closed 2 months ago

miniboxhaha commented 2 months ago

think there need use minio in different methods,do i need or should make a client in each method?

funtion a(){
  ...some code

  minio::s3::BaseUrl base_url(host, false);
  minio::creds::StaticProvider provider(user, pwd);
  minio::s3::Client client(base_url, &provider);
  //use cilent do something

  ...somecode
}

funtion b(){
  ...some code

  minio::s3::BaseUrl base_url(host, false);
  minio::creds::StaticProvider provider(user, pwd);
  minio::s3::Client client(base_url, &provider);
  //use cilent do something

  ...somecode
}

without use global var, is there a way make it easy?