diff --git a/src/FileCache.UnitTests/FileCache.UnitTests.csproj b/src/FileCache.UnitTests/FileCache.UnitTests.csproj index 5ffe0f1..ccc8f85 100644 --- a/src/FileCache.UnitTests/FileCache.UnitTests.csproj +++ b/src/FileCache.UnitTests/FileCache.UnitTests.csproj @@ -1,6 +1,6 @@  - net452;netcoreapp5.0 + netcoreapp5.0 false true true diff --git a/src/FileCache/FileCache.cs b/src/FileCache/FileCache.cs index 34ad22e..1212e09 100644 --- a/src/FileCache/FileCache.cs +++ b/src/FileCache/FileCache.cs @@ -692,8 +692,9 @@ public void Flush(DateTime minDate, string regionName = null) string policyPath = CacheManager.GetPolicyPath(key, region); string cachePath = CacheManager.GetCachePath(key, region); - // Update the Cache size + // Update the Cache size before flushing this item. CurrentCacheSize = GetCacheSize(); + //if either policy or cache are stale, delete both if (File.GetLastAccessTime(policyPath) < minDate || File.GetLastAccessTime(cachePath) < minDate) { @@ -706,6 +707,7 @@ public void Flush(DateTime minDate, string regionName = null) cLock.Close(); } } + /// /// Returns the policy attached to a given cache item. /// diff --git a/src/FileCache/FileCacheManager.cs b/src/FileCache/FileCacheManager.cs index 2d8bc09..3cf6b71 100644 --- a/src/FileCache/FileCacheManager.cs +++ b/src/FileCache/FileCacheManager.cs @@ -488,6 +488,18 @@ public void WriteSysValue(string filename, long data) } } + /// + /// Writes a long to a system file that is not part of the cache itself, + /// but is used to help it function. + /// + /// The name of the sysfile (without directory) + /// The DateTime to write to the file + public void WriteSysValue(string filename, DateTime data) + { + // Convert to long and use long's function. + WriteSysValue(filename, data.ToBinary()); + } + /// /// This function servies to centralize file stream access within this class. ///