Best practices for wrapping third-party singletons

What is the best practice when using singletons?

I have a third party client that I have to build and initialize and then use in various effects (e.g. getX(), getY()), such as in a repository service, or in multiple repositories (the same client instance will be shared by XRepo , YRepo, etc.).

I was thinking of creating an Effect that constructs the client and wrapping that Effect with Effect.cached and then yielding from that cached effect in every repository that needs it for example.
Was this page helpful?