From 80fd36dc89abae74768c780f8f4c53002f998778 Mon Sep 17 00:00:00 2001 From: Cole Brown Date: Wed, 28 Jul 2021 11:23:40 -0700 Subject: [PATCH] Cleaned up whitespace in src/FileCache files. --- src/FileCache/BasicFileCacheManager.cs | 4 +-- src/FileCache/FileCache.cs | 44 ++++++++++++------------- src/FileCache/FileCacheManager.cs | 12 +++---- src/FileCache/HashedFileCacheManager.cs | 4 +-- src/FileCache/PriortyQueue.cs | 4 +-- 5 files changed, 34 insertions(+), 34 deletions(-) diff --git a/src/FileCache/BasicFileCacheManager.cs b/src/FileCache/BasicFileCacheManager.cs index c3e9c4f..a6fb4e6 100644 --- a/src/FileCache/BasicFileCacheManager.cs +++ b/src/FileCache/BasicFileCacheManager.cs @@ -11,7 +11,7 @@ namespace System.Runtime.Caching public class BasicFileCacheManager : FileCacheManager { /// - /// Returns a list of keys for a given region. + /// Returns a list of keys for a given region. /// /// /// @@ -33,7 +33,7 @@ public override IEnumerable GetKeys(string regionName = null) } /// - /// Builds a string that will place the specified file name within the appropriate + /// Builds a string that will place the specified file name within the appropriate /// cache and workspace folder. /// /// diff --git a/src/FileCache/FileCache.cs b/src/FileCache/FileCache.cs index 84464a9..89c832e 100644 --- a/src/FileCache/FileCache.cs +++ b/src/FileCache/FileCache.cs @@ -29,7 +29,7 @@ public class FileCache : ObjectCache private const string LastCleanedDateFile = "cache.lcd"; private const string CacheSizeFile = "cache.size"; // this is a file used to prevent multiple processes from trying to "clean" at the same time - private const string SemaphoreFile = "cache.sem"; + private const string SemaphoreFile = "cache.sem"; private long _currentCacheSize = 0; private PayloadMode _readMode = PayloadMode.Serializable; public string CacheDir { get; protected set; } @@ -52,7 +52,7 @@ public static FileCacheManagers DefaultCacheManager /// /// Used to abstract away the low-level details of file management. This allows - /// for multiple file formatting schemes based on use case. + /// for multiple file formatting schemes based on use case. /// public FileCacheManager CacheManager { get; protected set; } @@ -112,7 +112,7 @@ public PayloadMode PayloadReadMode { public TimeSpan FilenameAsPayloadSafetyMargin = TimeSpan.FromMinutes(10); /// - /// Used to determine how long the FileCache will wait for a file to become + /// Used to determine how long the FileCache will wait for a file to become /// available. Default (00:00:00) is indefinite. Should the timeout be /// reached, an exception will be thrown. /// @@ -136,7 +136,7 @@ public TimeSpan AccessTimeout /// /// Returns the approximate size of the file cache /// - public long CurrentCacheSize + public long CurrentCacheSize { get { @@ -163,7 +163,7 @@ private set CacheManager.WriteSysFile(CacheSizeFile, value); _currentCacheSize = value; } - } + } } /// @@ -171,7 +171,7 @@ private set /// public event EventHandler MaxCacheSizeReached = delegate { }; - public event EventHandler CacheResized = delegate { }; + public event EventHandler CacheResized = delegate { }; /// /// The default cache path used by FC. @@ -311,10 +311,10 @@ private void Init( bool setCacheDirToDefault = true, bool setBinderToDefault = true ) - { + { _name = "FileCache_" + _nameCounter; _nameCounter++; - + DefaultRegion = null; DefaultPolicy = new CacheItemPolicy(); MaxCacheSize = long.MaxValue; @@ -337,7 +337,7 @@ private void Init( // only set the clean interval if the user supplied it if (cleanInterval > new TimeSpan()) - { + { _cleanInterval = cleanInterval; } @@ -356,7 +356,7 @@ private void Init( } else if (calculateCacheSize || CurrentCacheSize == 0) { - // This is in an else if block, because CleanCacheAsync will + // This is in an else if block, because CleanCacheAsync will // update the cache size, so no need to do it twice. UpdateCacheSizeAsync(); } @@ -422,7 +422,7 @@ private bool ShouldClean() public long ShrinkCacheToSize(long newSize, string regionName = null) { long originalSize = 0, amount = 0, removed = 0; - + //lock down other treads from trying to shrink or clean using (FileStream cLock = GetCleaningLock()) { @@ -480,7 +480,7 @@ public void CleanCacheAsync() public long CleanCache(string regionName = null) { long removed = 0; - + //lock down other treads from trying to shrink or clean using (FileStream cLock = GetCleaningLock()) { @@ -529,10 +529,10 @@ public long CleanCache(string regionName = null) /// /// The amount of data that was actually removed private long DeleteOldestFiles(long amount, string regionName = null) - { + { // Verify that we actually need to shrink if (amount <= 0) - { + { return 0; } @@ -576,7 +576,7 @@ private long DeleteOldestFiles(long amount, string regionName = null) } /// - /// This method calls GetCacheSize on a separate thread to + /// This method calls GetCacheSize on a separate thread to /// calculate and then store the size of the cache. /// public void UpdateCacheSizeAsync() @@ -717,7 +717,7 @@ public void Flush(DateTime minDate, string regionName = null) } } /// - /// Returns the policy attached to a given cache item. + /// Returns the policy attached to a given cache item. /// /// The key of the item /// The region in which the key exists @@ -837,7 +837,7 @@ public override DefaultCacheCapabilities DefaultCacheCapabilities ; } } - + public override object Get(string key, string regionName = null) { FileCachePayload payload = CacheManager.ReadFile(PayloadReadMode, key, regionName) as FileCachePayload; @@ -861,7 +861,7 @@ public override object Get(string key, string regionName = null) //delete the file from the cache try { - // CT Note: I changed this to Remove from File.Delete so that the coresponding + // CT Note: I changed this to Remove from File.Delete so that the coresponding // policy file will be deleted as well, and CurrentCacheSize will be updated. Remove(key, regionName); } @@ -877,7 +877,7 @@ public override object Get(string key, string regionName = null) payload.Policy.AbsoluteExpiration = DateTime.Now.Add(payload.Policy.SlidingExpiration); WriteHelper(PayloadWriteMode, key, payload, regionName, true); } - + } } else @@ -967,7 +967,7 @@ public override object Remove(string key, string regionName = null) { object valueToDelete = null; - + if (Contains(key, regionName) == true) { @@ -993,7 +993,7 @@ public override object Remove(string key, string regionName = null) catch (IOException) { } - + } return valueToDelete; } @@ -1044,7 +1044,7 @@ public override Type BindToType(string assemblyName, string typeName) } } - // CT: This private class is used to help shrink the cache. + // CT: This private class is used to help shrink the cache. // It computes the total size of an entry including it's policy file. // It also implements IComparable functionality to allow for sorting based on access time private class CacheItemReference : IComparable diff --git a/src/FileCache/FileCacheManager.cs b/src/FileCache/FileCacheManager.cs index a7e600a..28121af 100644 --- a/src/FileCache/FileCacheManager.cs +++ b/src/FileCache/FileCacheManager.cs @@ -18,7 +18,7 @@ public abstract class FileCacheManager public SerializationBinder Binder { get; set; } /// - /// Used to determine how long the FileCache will wait for a file to become + /// Used to determine how long the FileCache will wait for a file to become /// available. Default (00:00:00) is indefinite. Should the timeout be /// reached, an exception will be thrown. /// @@ -219,16 +219,16 @@ public virtual long WriteFile(FileCache.PayloadMode mode, string key, FileCacheP } /// - /// Builds a string that will place the specified file name within the appropriate + /// Builds a string that will place the specified file name within the appropriate /// cache and workspace folder. /// /// /// /// public abstract string GetCachePath(string key, string regionName = null); - + /// - /// Returns a list of keys for a given region. + /// Returns a list of keys for a given region. /// /// /// @@ -262,7 +262,7 @@ public IEnumerable GetRegions() /// /// Reads data in from a system file. System files are not part of the - /// cache itself, but serve as a way for the cache to store data it + /// cache itself, but serve as a way for the cache to store data it /// needs to operate. /// /// The name of the sysfile (without directory) @@ -390,7 +390,7 @@ public virtual long DeleteFile(string key, string regionName = null) } catch (IOException ex) { - //Owning FC might be interested in this exception. + //Owning FC might be interested in this exception. throw ex; } return Math.Abs(bytesFreed); diff --git a/src/FileCache/HashedFileCacheManager.cs b/src/FileCache/HashedFileCacheManager.cs index aff7fc8..45abe92 100644 --- a/src/FileCache/HashedFileCacheManager.cs +++ b/src/FileCache/HashedFileCacheManager.cs @@ -85,7 +85,7 @@ private string GetFileName(string key, string regionName = null) } /// - /// Builds a string that will place the specified file name within the appropriate + /// Builds a string that will place the specified file name within the appropriate /// cache and workspace folder. /// /// @@ -106,7 +106,7 @@ public override string GetCachePath(string key, string regionName = null) } /// - /// Returns a list of keys for a given region. + /// Returns a list of keys for a given region. /// /// public override IEnumerable GetKeys(string regionName = null) diff --git a/src/FileCache/PriortyQueue.cs b/src/FileCache/PriortyQueue.cs index 8b5e7f5..7fe70d4 100644 --- a/src/FileCache/PriortyQueue.cs +++ b/src/FileCache/PriortyQueue.cs @@ -23,8 +23,8 @@ public class PriortyQueue where T : IComparable /// /// Default constructor. /// - /// The comparer to use. The default comparer will make the smallest item the root of the heap. - /// + /// The comparer to use. The default comparer will make the smallest item the root of the heap. + /// /// public PriortyQueue(IComparer comparer = null) {