Skip to content

Commit

Permalink
Cleaned up whitespace in src/FileCache files.
Browse files Browse the repository at this point in the history
  • Loading branch information
cole-brown committed Jul 28, 2021
1 parent 8caa3f9 commit 80fd36d
Show file tree
Hide file tree
Showing 5 changed files with 34 additions and 34 deletions.
4 changes: 2 additions & 2 deletions src/FileCache/BasicFileCacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ namespace System.Runtime.Caching
public class BasicFileCacheManager : FileCacheManager
{
/// <summary>
/// Returns a list of keys for a given region.
/// Returns a list of keys for a given region.
/// </summary>
/// <param name="regionName"></param>
/// <returns></returns>
Expand All @@ -33,7 +33,7 @@ public override IEnumerable<string> GetKeys(string regionName = null)
}

/// <summary>
/// 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.
/// </summary>
/// <param name="FileName"></param>
Expand Down
44 changes: 22 additions & 22 deletions src/FileCache/FileCache.cs
Original file line number Diff line number Diff line change
Expand Up @@ -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; }
Expand All @@ -52,7 +52,7 @@ public static FileCacheManagers DefaultCacheManager

/// <summary>
/// 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.
/// </summary>
public FileCacheManager CacheManager { get; protected set; }

Expand Down Expand Up @@ -112,7 +112,7 @@ public PayloadMode PayloadReadMode {
public TimeSpan FilenameAsPayloadSafetyMargin = TimeSpan.FromMinutes(10);

/// <summary>
/// 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.
/// </summary>
Expand All @@ -136,7 +136,7 @@ public TimeSpan AccessTimeout
/// <summary>
/// Returns the approximate size of the file cache
/// </summary>
public long CurrentCacheSize
public long CurrentCacheSize
{
get
{
Expand All @@ -163,15 +163,15 @@ private set
CacheManager.WriteSysFile(CacheSizeFile, value);
_currentCacheSize = value;
}
}
}
}

/// <summary>
/// Event that will be called when <see cref="MaxCacheSize"/> is reached.
/// </summary>
public event EventHandler<FileCacheEventArgs> MaxCacheSizeReached = delegate { };

public event EventHandler<FileCacheEventArgs> CacheResized = delegate { };
public event EventHandler<FileCacheEventArgs> CacheResized = delegate { };

/// <summary>
/// The default cache path used by FC.
Expand Down Expand Up @@ -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;
Expand All @@ -337,7 +337,7 @@ private void Init(

// only set the clean interval if the user supplied it
if (cleanInterval > new TimeSpan())
{
{
_cleanInterval = cleanInterval;
}

Expand All @@ -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();
}
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -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())
{
Expand Down Expand Up @@ -529,10 +529,10 @@ public long CleanCache(string regionName = null)
/// </summary>
/// <returns>The amount of data that was actually removed</returns>
private long DeleteOldestFiles(long amount, string regionName = null)
{
{
// Verify that we actually need to shrink
if (amount <= 0)
{
{
return 0;
}

Expand Down Expand Up @@ -576,7 +576,7 @@ private long DeleteOldestFiles(long amount, string regionName = null)
}

/// <summary>
/// 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.
/// </summary>
public void UpdateCacheSizeAsync()
Expand Down Expand Up @@ -717,7 +717,7 @@ public void Flush(DateTime minDate, string regionName = null)
}
}
/// <summary>
/// Returns the policy attached to a given cache item.
/// Returns the policy attached to a given cache item.
/// </summary>
/// <param name="key">The key of the item</param>
/// <param name="regionName">The region in which the key exists</param>
Expand Down Expand Up @@ -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;
Expand All @@ -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);
}
Expand All @@ -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
Expand Down Expand Up @@ -967,7 +967,7 @@ public override object Remove(string key, string regionName = null)
{
object valueToDelete = null;


if (Contains(key, regionName) == true)
{

Expand All @@ -993,7 +993,7 @@ public override object Remove(string key, string regionName = null)
catch (IOException)
{
}

}
return valueToDelete;
}
Expand Down Expand Up @@ -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<CacheItemReference>
Expand Down
12 changes: 6 additions & 6 deletions src/FileCache/FileCacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ public abstract class FileCacheManager
public SerializationBinder Binder { get; set; }

/// <summary>
/// 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.
/// </summary>
Expand Down Expand Up @@ -219,16 +219,16 @@ public virtual long WriteFile(FileCache.PayloadMode mode, string key, FileCacheP
}

/// <summary>
/// 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.
/// </summary>
/// <param name="key"></param>
/// <param name="regionName"></param>
/// <returns></returns>
public abstract string GetCachePath(string key, string regionName = null);

/// <summary>
/// Returns a list of keys for a given region.
/// Returns a list of keys for a given region.
/// </summary>
/// <param name="regionName"></param>
/// <returns></returns>
Expand Down Expand Up @@ -262,7 +262,7 @@ public IEnumerable<string> GetRegions()

/// <summary>
/// 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.
/// </summary>
/// <param name="filename">The name of the sysfile (without directory)</param>
Expand Down Expand Up @@ -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);
Expand Down
4 changes: 2 additions & 2 deletions src/FileCache/HashedFileCacheManager.cs
Original file line number Diff line number Diff line change
Expand Up @@ -85,7 +85,7 @@ private string GetFileName(string key, string regionName = null)
}

/// <summary>
/// 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.
/// </summary>
/// <param name="key"></param>
Expand All @@ -106,7 +106,7 @@ public override string GetCachePath(string key, string regionName = null)
}

/// <summary>
/// Returns a list of keys for a given region.
/// Returns a list of keys for a given region.
/// </summary>
/// <param name="regionName"></param>
public override IEnumerable<string> GetKeys(string regionName = null)
Expand Down
4 changes: 2 additions & 2 deletions src/FileCache/PriortyQueue.cs
Original file line number Diff line number Diff line change
Expand Up @@ -23,8 +23,8 @@ public class PriortyQueue<T> where T : IComparable<T>
/// <summary>
/// Default constructor.
/// </summary>
/// <param name="comparer">The comparer to use. The default comparer will make the smallest item the root of the heap.
///
/// <param name="comparer">The comparer to use. The default comparer will make the smallest item the root of the heap.
///
/// </param>
public PriortyQueue(IComparer<T> comparer = null)
{
Expand Down

0 comments on commit 80fd36d

Please sign in to comment.