예제 #1
0
        /// <summary>
        ///     添加缓存
        /// </summary>
        public static void SetCache(IScopedResolver resolver, Dependency dependency, object value)
        {
            var key = new Tuple <IScopedResolver, Dependency>(resolver, dependency);

            lock (Sync)
            {
                Update(key, value);
            }
            ScopedKeyCacheManager.SetCache(resolver, key);
        }
        /// <summary>
        ///     设置缓存
        /// </summary>
        public static void SetCache(IScopedResolver key, Tuple <IScopedResolver, Dependency> scopedKey = null)
        {
            var collection = new ScopedKeyCacheManager(key).GetValue();

            if (scopedKey == null)
            {
                return;
            }
            lock (Sync)
            {
                ((List <Tuple <IScopedResolver, Dependency> >)collection).Add(scopedKey);
            }
        }