/// <summary> /// 获取缓存 /// </summary> public static Dependency GetCache(IScopedResolver key, Type serviceType) { var dependencyEntries = new DependencyCacheManager(key).GetValue(); return(dependencyEntries.ContainsKey(serviceType) ? dependencyEntries[serviceType] : default(Dependency)); }
/// <summary> /// 设置缓存 /// </summary> public static void SetCache(IScopedResolver key, IEnumerable <Dependency> dependencyEntries) { var cache = new DependencyCacheManager(key).GetValue(); dependencyEntries.ForEach(dependency => cache.Add(dependency.ServiceType, dependency)); }