The simple conclusion is that service locators that cache are a bad idea.
简单的结论是:使用服务定位器进行缓存不是一个好的主意。
It is still a good idea to use service locators to encapsulate resource access.
同样,使用服务定位器封装资源访问、以集合的形式使用服务定位器也是一个不错的想法。
Components could avoid the problem of overloaded names being cached by not using service locators at all, but that would be overkill.
组件可以通过根本不使用服务定位器而避免重载缓存的名称的问题,但是这种方法又有点错杀一千的感觉。
应用推荐