Пример #1
0
        private void RemoveKey(string key, string prefix = null)
        {
            var affectedKeys       = new HashSet <string>();
            var commonDependencies = _htmlCache.GetDependencies(AllDependencyKey);

            foreach (var commonDependency in commonDependencies)
            {
                affectedKeys.Add(commonDependency);
            }

            CollectDependencyKeys(affectedKeys, key, prefix);

            _htmlCache.Remove(affectedKeys);
        }
        private void CollectDependencyKeys(HashSet <string> dependencies, string key)
        {
            dependencies.Add(key);
            var keyDependencies = _htmlCache.GetDependencies(key);

            foreach (var dependencyKey in keyDependencies)
            {
                if (dependencyKey.StartsWith("/"))
                {
                    dependencies.Add(dependencyKey);
                }
                else
                {
                    CollectDependencyKeys(dependencies, dependencyKey);
                }
            }
        }