Lock() 공개 메소드

public Lock ( ) : ActionOnDispose,
리턴 ActionOnDispose,
        /// <summary>
        ///     Flush the cache.
        /// </summary>
        public void Flush()
        {
            using (StateLock.Lock())
            {
                Assemblies.Clear();

                IsDirty = true;
            }
        }
        /// <summary>
        ///     Load cache state from the specified file.
        /// </summary>
        /// <param name="cacheFile">
        ///     The file containing persisted cache state.
        /// </param>
        public void Load(string cacheFile)
        {
            if (String.IsNullOrWhiteSpace(cacheFile))
            {
                throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'cacheFile'.", nameof(cacheFile));
            }

            using (StateLock.Lock())
            {
                Assemblies.Clear();

                using (StreamReader input = File.OpenText(cacheFile))
                    using (JsonTextReader json = new JsonTextReader(input))
                    {
                        JsonSerializer.Create(SerializerSettings).Populate(json, this);
                    }

                IsDirty = false;
            }
        }
        /// <summary>
        ///     Write cache state to the specified file.
        /// </summary>
        /// <param name="cacheFile">
        ///     The file that will contain cache state.
        /// </param>
        public void Save(string cacheFile)
        {
            if (String.IsNullOrWhiteSpace(cacheFile))
            {
                throw new ArgumentException("Argument cannot be null, empty, or entirely composed of whitespace: 'cacheFile'.", nameof(cacheFile));
            }

            using (StateLock.Lock())
            {
                if (File.Exists(cacheFile))
                {
                    File.Delete(cacheFile);
                }

                using (StreamWriter output = File.CreateText(cacheFile))
                    using (JsonTextWriter json = new JsonTextWriter(output))
                    {
                        JsonSerializer.Create(SerializerSettings).Serialize(json, this);
                    }

                IsDirty = false;
            }
        }