Skip to content

Should client object be reused? #2510

Answered by iann0036
cs-ranbi asked this question in Q&A
Discussion options

You must be logged in to vote

It's optimal to create one client object (per service) and reuse it wherever possible.

In platforms like Lambda, initialisation is recommended to be done outside of the handler function to slightly optimise the code for future invocations. If you're using a service object pattern within Go, the client is typically stored within the service and used by any associated methods that need it.

Replies: 1 comment

Comment options

You must be logged in to vote
0 replies
Answer selected by lucix-aws
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
2 participants