Is there an advantage to using LazyCache as a service?

35 Views Asked by At

LazyService describes how to use it directly or as a service. I'm still somewhat new to the whole concept of Dependency Injection and so I'm curious.

Calling it directly (not going the DI route) is a lot simpler & easier. So why would you instead go the DI approach? The document it as an option so I'm guessing there are advantages and I'd like to understand them.

The only advantage that occurred to me is you can then use a different library. But the use of LazyService is built around GetOrAddAsync() and I don't think any replacement would have that.

0

There are 0 best solutions below