Catel.IoC.TypeFactory.ClearCache C# (CSharp) Method

ClearCache() public method

Clears the cache of all constructors. This call is normally not necessary since the type factory should keep an eye on the IServiceLocator.TypeRegistered event to invalidate the cache.
public ClearCache ( ) : void
return void
        public void ClearCache()
        {
            // Note that we don't clear the constructor metadata cache, constructors on types normally don't change during an
            // application lifetime

            // Clear cache isn't really that important, it's better to prevent deadlocks. How can a deadlock occur? If thread x is creating 
            // a type and loads an assembly, but thread y is also loading an assembly. Thread x will lock because it's creating the type, 
            // thread y will lock because it wants to clear the cache because new types were added. In that case ignore clearing the cache

            if (Monitor.TryEnter(_serviceLocator))
            {
                try
                {
                    _specificConstructorCacheWithoutAutoCompletion.Clear();
                    _specificConstructorCacheWithAutoCompletion.Clear();
                }
                finally
                {
                    Monitor.Exit(_serviceLocator);
                }
            }

            //Log.Debug("Cleared type constructor cache");
        }