BreadBoard
BreadBoard copied to clipboard
Singleton::WithParameters does not lock
BB::Lifecycle::Singleton uses a lock while geting, but BB::Lifecycle::Singleton::WithParameters does not. Why? Should it? Should the lock be on the whole service, or on the specific get call (i.e. should we have a single boolean lock, or a hashref from parameters keys to booleans)?
You could add a lock here, how much value it provides I don't know. My experience with Singleton::WithParameters is that it is very rare to actually create singletons with the same parameters in practice, so locking, while correct, is likely not that important.