What is a Singleton?
When using Singleton we only register the service one time. This means that the registered object is the same for every object and every request.
When to use Singleton?
When you use a singleton, you have to make sure that there can only be one object, that it controls concurrent access to a shared resource, and that access to the resource will be requested only from multiple, disparate parts of your application.
In most cases, I only use a singleton for logging objects and reading configuration files that I’m sure I only need to read once like at startup for databases, server settings, etc… and encapsulate in a singleton.