diff --git a/.vs/Caching/v15/.suo b/.vs/Caching/v15/.suo index ac31c4f..78d6c8b 100644 Binary files a/.vs/Caching/v15/.suo and b/.vs/Caching/v15/.suo differ diff --git a/.vs/Caching/v15/Server/sqlite3/storage.ide-shm b/.vs/Caching/v15/Server/sqlite3/storage.ide-shm index 00461ca..961c855 100644 Binary files a/.vs/Caching/v15/Server/sqlite3/storage.ide-shm and b/.vs/Caching/v15/Server/sqlite3/storage.ide-shm differ diff --git a/.vs/Caching/v15/Server/sqlite3/storage.ide-wal b/.vs/Caching/v15/Server/sqlite3/storage.ide-wal index 1a076c7..8c7d0b0 100644 Binary files a/.vs/Caching/v15/Server/sqlite3/storage.ide-wal and b/.vs/Caching/v15/Server/sqlite3/storage.ide-wal differ diff --git a/Caching/Caching.csproj b/Caching/Caching.csproj index 4756977..9baf149 100644 --- a/Caching/Caching.csproj +++ b/Caching/Caching.csproj @@ -4,7 +4,7 @@ netstandard2.0;net452 true Caching.dll - 1.2.1 + 1.3.1 Joel Christner Simple C# caching library including a FIFO and LRU cache (c)2019 Joel Christner @@ -12,11 +12,13 @@ https://github.com/jchristn/caching Github https://github.com/jchristn/Caching/blob/master/LICENSE.txt - Retarget to .NET Core 2.0 and .NET Framework 4.5.2 + Retarget to .NET Core 2.0 and .NET Framework 4.5.2, remove CSharpTest.Net.Collections (BTree support) due to licensing and compatibility with .NET Core 2.0 + 1.3.1.0 + 1.3.1.0 + fifo lru cache caching least recently used first in first out simple - diff --git a/Caching/LRUCacheBTree.cs b/Caching/LRUCacheBTree.cs deleted file mode 100644 index 990a022..0000000 --- a/Caching/LRUCacheBTree.cs +++ /dev/null @@ -1,263 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Diagnostics; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using CSharpTest.Net.Collections; -using CSharpTest.Net.Serialization; - -namespace Caching -{ - /// - /// LRU cache that internally uses a BTree (refer to CSharpTest.Net). - /// - public class LRUCacheBTree - { - /// - /// Enable or disable console debugging. - /// - public bool Debug; - - private int _Capacity; - private int _EvictCount; - private readonly object _CacheLock = new object(); - private BPlusTree> _Cache = new BPlusTree>(); - - /// - /// Initialize the cache. - /// - /// Maximum number of entries. - /// Number to evict when capacity is reached. - /// Enable or disable console debugging. - public LRUCacheBTree(int capacity, int evictCount, bool debug) - { - _Capacity = capacity; - _EvictCount = evictCount; - Debug = debug; - _Cache = new BPlusTree>(); - _Cache.EnableCount(); - - if (_EvictCount > _Capacity) - { - throw new ArgumentException("Evict count must be less than or equal to capacity."); - } - } - - /// - /// Retrieve the current number of entries in the cache. - /// - /// An integer containing the number of entries. - public int Count() - { - lock (_CacheLock) - { - return _Cache.Count; - } - } - - /// - /// Retrieve the key of the oldest entry in the cache. - /// - /// String containing the key. - public T1 Oldest() - { - if (_Cache == null || _Cache.Count < 1) throw new KeyNotFoundException(); ; - - lock (_CacheLock) - { - KeyValuePair> oldest = _Cache.Where(x => x.Value.Added != null).OrderBy(x => x.Value.Added).First(); - return oldest.Key; - } - } - - /// - /// Retrieve the key of the newest entry in the cache. - /// - /// String containing the key. - public T1 Newest() - { - if (_Cache == null || _Cache.Count < 1) throw new KeyNotFoundException(); - - lock (_CacheLock) - { - KeyValuePair> newest = _Cache.Where(x => x.Value.Added != null).OrderBy(x => x.Value.Added).Last(); - return newest.Key; - } - } - - /// - /// Retrieve the key of the last used entry in the cache. - /// - /// String containing the key. - public T1 LastUsed() - { - if (_Cache == null || _Cache.Count < 1) throw new KeyNotFoundException(); - - lock (_CacheLock) - { - KeyValuePair> newest = _Cache.Where(x => x.Value.LastUsed != null).OrderBy(x => x.Value.LastUsed).Last(); - return newest.Key; - } - } - - /// - /// Retrieve the key of the first used entry in the cache. - /// - /// String containing the key. - public T1 FirstUsed() - { - if (_Cache == null || _Cache.Count < 1) throw new KeyNotFoundException(); - - lock (_CacheLock) - { - KeyValuePair> oldest = _Cache.Where(x => x.Value.LastUsed != null).OrderBy(x => x.Value.LastUsed).First(); - return oldest.Key; - } - } - - /// - /// Clear the cache. - /// - public void Clear() - { - lock (_CacheLock) - { - _Cache = new BPlusTree>(); - _Cache.EnableCount(); - return; - } - } - - /// - /// Retrieve a key's value from the cache. - /// - /// The key associated with the data you wish to retrieve. - /// The object data associated with the key. - public T2 Get(T1 key) - { - if (key == null) throw new ArgumentNullException(nameof(key)); - - lock (_CacheLock) - { - if (_Cache.ContainsKey(key)) - { - KeyValuePair> curr = _Cache.Where(x => x.Key.Equals(key)).First(); - - // update LastUsed - _Cache.Remove(key); - curr.Value.LastUsed = DateTime.Now; - _Cache.Add(key, curr.Value); - - // return data - return curr.Value.Data; - } - else - { - throw new KeyNotFoundException(); - } - } - } - - /// - /// Retrieve a key's value from the cache. - /// - /// The key associated with the data you wish to retrieve. - /// The value associated with the key. - /// True if key is found. - public bool TryGet(T1 key, out T2 val) - { - if (key == null) throw new ArgumentNullException(nameof(key)); - - lock (_CacheLock) - { - if (_Cache.ContainsKey(key)) - { - KeyValuePair> curr = _Cache.Where(x => x.Key.Equals(key)).First(); - - // update LastUsed - _Cache.Remove(key); - curr.Value.LastUsed = DateTime.Now; - _Cache.Add(key, curr.Value); - - // return data - val = curr.Value.Data; - return true; - } - else - { - val = default(T2); - return false; - } - } - } - - /// - /// Add or replace a key's value in the cache. - /// - /// The key. - /// The value associated with the key. - /// Boolean indicating success. - public void AddReplace(T1 key, T2 val) - { - if (key == null) throw new ArgumentNullException(nameof(key)); - - lock (_CacheLock) - { - if (_Cache.ContainsKey(key)) - { - _Cache.Remove(key); - } - - if (_Cache.Count >= _Capacity) - { - int evictedCount = 0; - while (evictedCount < _EvictCount) - { - KeyValuePair> oldest = _Cache.Where(x => x.Value.LastUsed != null).OrderBy(x => x.Value.LastUsed).First(); - _Cache.Remove(oldest.Key); - evictedCount++; - } - } - - DataNode curr = new DataNode(val); - _Cache.Add(key, curr); - return; - } - } - - /// - /// Remove a key from the cache. - /// - /// The key. - /// Boolean indicating success. - public void Remove(T1 key) - { - if (key == null) throw new ArgumentNullException(nameof(key)); - - lock (_CacheLock) - { - if (_Cache.ContainsKey(key)) - { - _Cache.Remove(key); - } - - return; - } - } - - /// - /// Retrieve all keys in the cache. - /// - /// List of string. - public List GetKeys() - { - lock (_CacheLock) - { - List keys = new List(_Cache.Keys); - return keys; - } - } - } -} diff --git a/Caching/bin/Release/Caching.dll.1.3.0.nupkg b/Caching/bin/Release/Caching.dll.1.3.0.nupkg new file mode 100644 index 0000000..ce32254 Binary files /dev/null and b/Caching/bin/Release/Caching.dll.1.3.0.nupkg differ diff --git a/Caching/bin/Release/Caching.dll.1.3.1.nupkg b/Caching/bin/Release/Caching.dll.1.3.1.nupkg new file mode 100644 index 0000000..cebbcdb Binary files /dev/null and b/Caching/bin/Release/Caching.dll.1.3.1.nupkg differ diff --git a/Caching/bin/Release/net452/CSharpTest.Net.Collections.dll b/Caching/bin/Release/net452/CSharpTest.Net.Collections.dll deleted file mode 100644 index a93fdec..0000000 Binary files a/Caching/bin/Release/net452/CSharpTest.Net.Collections.dll and /dev/null differ diff --git a/Caching/bin/Release/net452/Caching.dll b/Caching/bin/Release/net452/Caching.dll index b42b7c0..d5e8dcc 100644 Binary files a/Caching/bin/Release/net452/Caching.dll and b/Caching/bin/Release/net452/Caching.dll differ diff --git a/Caching/bin/Release/net452/Caching.pdb b/Caching/bin/Release/net452/Caching.pdb index af9fb3b..5447cb3 100644 Binary files a/Caching/bin/Release/net452/Caching.pdb and b/Caching/bin/Release/net452/Caching.pdb differ diff --git a/Caching/bin/Release/netstandard2.0/Caching.deps.json b/Caching/bin/Release/netstandard2.0/Caching.deps.json index c056f09..2658e4f 100644 --- a/Caching/bin/Release/netstandard2.0/Caching.deps.json +++ b/Caching/bin/Release/netstandard2.0/Caching.deps.json @@ -1,15 +1,14 @@ { "runtimeTarget": { "name": ".NETStandard,Version=v2.0/", - "signature": "38467701252bed515fc7366b02a77545e9bdcdc3" + "signature": "a6329fa9c186650eb6a521a7842eed96abe87ddc" }, "compilationOptions": {}, "targets": { ".NETStandard,Version=v2.0": {}, ".NETStandard,Version=v2.0/": { - "Caching/1.2.1": { + "Caching/1.3.1": { "dependencies": { - "CSharpTest.Net.Collections": "14.906.1403.1082", "Microsoft.CSharp": "4.5.0", "NETStandard.Library": "2.0.3" }, @@ -17,14 +16,6 @@ "Caching.dll": {} } }, - "CSharpTest.Net.Collections/14.906.1403.1082": { - "runtime": { - "lib/net40/CSharpTest.Net.Collections.dll": { - "assemblyVersion": "14.906.1403.1082", - "fileVersion": "14.906.1403.1082" - } - } - }, "Microsoft.CSharp/4.5.0": { "runtime": { "lib/netstandard2.0/Microsoft.CSharp.dll": { @@ -42,18 +33,11 @@ } }, "libraries": { - "Caching/1.2.1": { + "Caching/1.3.1": { "type": "project", "serviceable": false, "sha512": "" }, - "CSharpTest.Net.Collections/14.906.1403.1082": { - "type": "package", - "serviceable": true, - "sha512": "sha512-31Pu0wcHG2c814AUVPSzyL/ijcfyvu4S524+uxOhx2d1dRiIJ9eMLLvRWUhhP7F0Q17cvQpnGnZk8+4DhdJPgg==", - "path": "csharptest.net.collections/14.906.1403.1082", - "hashPath": "csharptest.net.collections.14.906.1403.1082.nupkg.sha512" - }, "Microsoft.CSharp/4.5.0": { "type": "package", "serviceable": true, diff --git a/Caching/bin/Release/netstandard2.0/Caching.dll b/Caching/bin/Release/netstandard2.0/Caching.dll index a722c6d..c498efd 100644 Binary files a/Caching/bin/Release/netstandard2.0/Caching.dll and b/Caching/bin/Release/netstandard2.0/Caching.dll differ diff --git a/Caching/bin/Release/netstandard2.0/Caching.pdb b/Caching/bin/Release/netstandard2.0/Caching.pdb index bdfe58f..9e4112f 100644 Binary files a/Caching/bin/Release/netstandard2.0/Caching.pdb and b/Caching/bin/Release/netstandard2.0/Caching.pdb differ diff --git a/Caching/obj/Caching.csproj.nuget.cache b/Caching/obj/Caching.csproj.nuget.cache index a50edd6..1bd47e1 100644 --- a/Caching/obj/Caching.csproj.nuget.cache +++ b/Caching/obj/Caching.csproj.nuget.cache @@ -1,5 +1,5 @@ { "version": 1, - "dgSpecHash": "EVfEqodzcZBG99IYD4XYMbQ1dpcZwmkGxAhXfW/Zp5gROQ4rNyoswkhzXsvU0M/TrPsg0rdjDUA0Hk9CsGRlyg==", + "dgSpecHash": "t47nC91SI7qgPMu8dL4/ifM3lYXF63SkLX1yRIyXBhb9ZrWab7LfmuZ2HB2215s+lNbQG0vrQ4GT94U2rd0Edw==", "success": true } \ No newline at end of file diff --git a/Caching/obj/Caching.csproj.nuget.g.props b/Caching/obj/Caching.csproj.nuget.g.props index af92479..8128bc5 100644 --- a/Caching/obj/Caching.csproj.nuget.g.props +++ b/Caching/obj/Caching.csproj.nuget.g.props @@ -3,7 +3,7 @@ True NuGet - C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\project.assets.json + C:\code\misc\Caching\Caching\obj\project.assets.json $(UserProfile)\.nuget\packages\ C:\Users\joelc\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder PackageReference diff --git a/Caching/obj/Release/Caching.dll.1.3.0.nuspec b/Caching/obj/Release/Caching.dll.1.3.0.nuspec new file mode 100644 index 0000000..df7745e --- /dev/null +++ b/Caching/obj/Release/Caching.dll.1.3.0.nuspec @@ -0,0 +1,28 @@ + + + + Caching.dll + 1.3.0 + Joel Christner + Joel Christner + false + https://github.com/jchristn/Caching/blob/master/LICENSE.txt + https://github.com/jchristn/caching + Simple C# caching library including a FIFO and LRU cache + Retarget to .NET Core 2.0 and .NET Framework 4.5.2, remove CSharpTest.Net.Collections (BTree support) due to licensing and compatibility with .NET Core 2.0 + (c)2019 Joel Christner + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Caching/obj/Release/Caching.dll.1.3.1.nuspec b/Caching/obj/Release/Caching.dll.1.3.1.nuspec new file mode 100644 index 0000000..6f622eb --- /dev/null +++ b/Caching/obj/Release/Caching.dll.1.3.1.nuspec @@ -0,0 +1,29 @@ + + + + Caching.dll + 1.3.1 + Joel Christner + Joel Christner + false + https://github.com/jchristn/Caching/blob/master/LICENSE.txt + https://github.com/jchristn/caching + Simple C# caching library including a FIFO and LRU cache + Retarget to .NET Core 2.0 and .NET Framework 4.5.2, remove CSharpTest.Net.Collections (BTree support) due to licensing and compatibility with .NET Core 2.0 + (c)2019 Joel Christner + fifo lru cache caching least recently used first in first out simple + + + + + + + + + + + + + + + \ No newline at end of file diff --git a/Caching/obj/Release/net452/Caching.AssemblyInfo.cs b/Caching/obj/Release/net452/Caching.AssemblyInfo.cs index 497d713..f1aa6f5 100644 --- a/Caching/obj/Release/net452/Caching.AssemblyInfo.cs +++ b/Caching/obj/Release/net452/Caching.AssemblyInfo.cs @@ -15,11 +15,11 @@ [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyCopyrightAttribute("(c)2019 Joel Christner")] [assembly: System.Reflection.AssemblyDescriptionAttribute("Simple C# caching library including a FIFO and LRU cache")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.1.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.1")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.3.1.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.3.1")] [assembly: System.Reflection.AssemblyProductAttribute("Caching")] [assembly: System.Reflection.AssemblyTitleAttribute("Caching")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.2.1.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.3.1.0")] // Generated by the MSBuild WriteCodeFragment class. diff --git a/Caching/obj/Release/net452/Caching.AssemblyInfoInputs.cache b/Caching/obj/Release/net452/Caching.AssemblyInfoInputs.cache index 07c555d..723f0b0 100644 --- a/Caching/obj/Release/net452/Caching.AssemblyInfoInputs.cache +++ b/Caching/obj/Release/net452/Caching.AssemblyInfoInputs.cache @@ -1 +1 @@ -0713119852bad0e56b5dde848ddf41562b5c10ed +8aa0ce91a182c49793655dca024599d1e723a951 diff --git a/Caching/obj/Release/net452/Caching.assets.cache b/Caching/obj/Release/net452/Caching.assets.cache index 12e9059..f24398c 100644 Binary files a/Caching/obj/Release/net452/Caching.assets.cache and b/Caching/obj/Release/net452/Caching.assets.cache differ diff --git a/Caching/obj/Release/net452/Caching.csproj.CopyComplete b/Caching/obj/Release/net452/Caching.csproj.CopyComplete deleted file mode 100644 index e69de29..0000000 diff --git a/Caching/obj/Release/net452/Caching.csproj.CoreCompileInputs.cache b/Caching/obj/Release/net452/Caching.csproj.CoreCompileInputs.cache index 56c58f0..7cffa42 100644 --- a/Caching/obj/Release/net452/Caching.csproj.CoreCompileInputs.cache +++ b/Caching/obj/Release/net452/Caching.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -3ed96684f5e6702f1a3fbd01352cfaf9d1aef189 +1e9166f19cbd295f7d9332f7445727f116687f9d diff --git a/Caching/obj/Release/net452/Caching.csproj.FileListAbsolute.txt b/Caching/obj/Release/net452/Caching.csproj.FileListAbsolute.txt index 2c269f4..d10ee15 100644 --- a/Caching/obj/Release/net452/Caching.csproj.FileListAbsolute.txt +++ b/Caching/obj/Release/net452/Caching.csproj.FileListAbsolute.txt @@ -8,3 +8,11 @@ C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\net452\Caching.Assembl C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\net452\Caching.csproj.CopyComplete C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\net452\Caching.dll C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\net452\Caching.pdb +C:\code\misc\Caching\Caching\bin\Release\net452\Caching.dll +C:\code\misc\Caching\Caching\bin\Release\net452\Caching.pdb +C:\code\misc\Caching\Caching\obj\Release\net452\Caching.csprojAssemblyReference.cache +C:\code\misc\Caching\Caching\obj\Release\net452\Caching.csproj.CoreCompileInputs.cache +C:\code\misc\Caching\Caching\obj\Release\net452\Caching.AssemblyInfoInputs.cache +C:\code\misc\Caching\Caching\obj\Release\net452\Caching.AssemblyInfo.cs +C:\code\misc\Caching\Caching\obj\Release\net452\Caching.dll +C:\code\misc\Caching\Caching\obj\Release\net452\Caching.pdb diff --git a/Caching/obj/Release/net452/Caching.csprojAssemblyReference.cache b/Caching/obj/Release/net452/Caching.csprojAssemblyReference.cache index 185b9de..800f6bf 100644 Binary files a/Caching/obj/Release/net452/Caching.csprojAssemblyReference.cache and b/Caching/obj/Release/net452/Caching.csprojAssemblyReference.cache differ diff --git a/Caching/obj/Release/net452/Caching.dll b/Caching/obj/Release/net452/Caching.dll index b42b7c0..d5e8dcc 100644 Binary files a/Caching/obj/Release/net452/Caching.dll and b/Caching/obj/Release/net452/Caching.dll differ diff --git a/Caching/obj/Release/net452/Caching.pdb b/Caching/obj/Release/net452/Caching.pdb index af9fb3b..5447cb3 100644 Binary files a/Caching/obj/Release/net452/Caching.pdb and b/Caching/obj/Release/net452/Caching.pdb differ diff --git a/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfo.cs b/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfo.cs index 497d713..f1aa6f5 100644 --- a/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfo.cs +++ b/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfo.cs @@ -15,11 +15,11 @@ [assembly: System.Reflection.AssemblyConfigurationAttribute("Release")] [assembly: System.Reflection.AssemblyCopyrightAttribute("(c)2019 Joel Christner")] [assembly: System.Reflection.AssemblyDescriptionAttribute("Simple C# caching library including a FIFO and LRU cache")] -[assembly: System.Reflection.AssemblyFileVersionAttribute("1.2.1.0")] -[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.2.1")] +[assembly: System.Reflection.AssemblyFileVersionAttribute("1.3.1.0")] +[assembly: System.Reflection.AssemblyInformationalVersionAttribute("1.3.1")] [assembly: System.Reflection.AssemblyProductAttribute("Caching")] [assembly: System.Reflection.AssemblyTitleAttribute("Caching")] -[assembly: System.Reflection.AssemblyVersionAttribute("1.2.1.0")] +[assembly: System.Reflection.AssemblyVersionAttribute("1.3.1.0")] // Generated by the MSBuild WriteCodeFragment class. diff --git a/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfoInputs.cache b/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfoInputs.cache index 07c555d..723f0b0 100644 --- a/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfoInputs.cache +++ b/Caching/obj/Release/netstandard2.0/Caching.AssemblyInfoInputs.cache @@ -1 +1 @@ -0713119852bad0e56b5dde848ddf41562b5c10ed +8aa0ce91a182c49793655dca024599d1e723a951 diff --git a/Caching/obj/Release/netstandard2.0/Caching.assets.cache b/Caching/obj/Release/netstandard2.0/Caching.assets.cache index 29ea29a..02ccb91 100644 Binary files a/Caching/obj/Release/netstandard2.0/Caching.assets.cache and b/Caching/obj/Release/netstandard2.0/Caching.assets.cache differ diff --git a/Caching/obj/Release/netstandard2.0/Caching.csproj.CoreCompileInputs.cache b/Caching/obj/Release/netstandard2.0/Caching.csproj.CoreCompileInputs.cache index 676464c..abffe12 100644 --- a/Caching/obj/Release/netstandard2.0/Caching.csproj.CoreCompileInputs.cache +++ b/Caching/obj/Release/netstandard2.0/Caching.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -b4b369f949be4603ff4f03d85d04eead8f460391 +21cb9e2da55fad2c2531c5cba26cfb4e5ee3cf4e diff --git a/Caching/obj/Release/netstandard2.0/Caching.csproj.FileListAbsolute.txt b/Caching/obj/Release/netstandard2.0/Caching.csproj.FileListAbsolute.txt index f6f592a..0e823eb 100644 --- a/Caching/obj/Release/netstandard2.0/Caching.csproj.FileListAbsolute.txt +++ b/Caching/obj/Release/netstandard2.0/Caching.csproj.FileListAbsolute.txt @@ -6,3 +6,12 @@ C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\netstandard2.0\Caching C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\netstandard2.0\Caching.AssemblyInfo.cs C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\netstandard2.0\Caching.dll C:\Code\Misc\CachingWithBtreeRetarget\Caching\obj\Release\netstandard2.0\Caching.pdb +C:\code\misc\Caching\Caching\bin\Release\netstandard2.0\Caching.deps.json +C:\code\misc\Caching\Caching\bin\Release\netstandard2.0\Caching.dll +C:\code\misc\Caching\Caching\bin\Release\netstandard2.0\Caching.pdb +C:\code\misc\Caching\Caching\obj\Release\netstandard2.0\Caching.csprojAssemblyReference.cache +C:\code\misc\Caching\Caching\obj\Release\netstandard2.0\Caching.csproj.CoreCompileInputs.cache +C:\code\misc\Caching\Caching\obj\Release\netstandard2.0\Caching.AssemblyInfoInputs.cache +C:\code\misc\Caching\Caching\obj\Release\netstandard2.0\Caching.AssemblyInfo.cs +C:\code\misc\Caching\Caching\obj\Release\netstandard2.0\Caching.dll +C:\code\misc\Caching\Caching\obj\Release\netstandard2.0\Caching.pdb diff --git a/Caching/obj/Release/netstandard2.0/Caching.csprojAssemblyReference.cache b/Caching/obj/Release/netstandard2.0/Caching.csprojAssemblyReference.cache new file mode 100644 index 0000000..f3aff38 Binary files /dev/null and b/Caching/obj/Release/netstandard2.0/Caching.csprojAssemblyReference.cache differ diff --git a/Caching/obj/Release/netstandard2.0/Caching.dll b/Caching/obj/Release/netstandard2.0/Caching.dll index a722c6d..c498efd 100644 Binary files a/Caching/obj/Release/netstandard2.0/Caching.dll and b/Caching/obj/Release/netstandard2.0/Caching.dll differ diff --git a/Caching/obj/Release/netstandard2.0/Caching.pdb b/Caching/obj/Release/netstandard2.0/Caching.pdb index bdfe58f..9e4112f 100644 Binary files a/Caching/obj/Release/netstandard2.0/Caching.pdb and b/Caching/obj/Release/netstandard2.0/Caching.pdb differ diff --git a/Caching/obj/project.assets.json b/Caching/obj/project.assets.json index 2957f4d..1cbfaac 100644 --- a/Caching/obj/project.assets.json +++ b/Caching/obj/project.assets.json @@ -2,15 +2,6 @@ "version": 3, "targets": { ".NETFramework,Version=v4.5.2": { - "CSharpTest.Net.Collections/14.906.1403.1082": { - "type": "package", - "compile": { - "lib/net40/CSharpTest.Net.Collections.dll": {} - }, - "runtime": { - "lib/net40/CSharpTest.Net.Collections.dll": {} - } - }, "Microsoft.CSharp/4.5.0": { "type": "package", "frameworkAssemblies": [ @@ -25,15 +16,6 @@ } }, ".NETStandard,Version=v2.0": { - "CSharpTest.Net.Collections/14.906.1403.1082": { - "type": "package", - "compile": { - "lib/net40/CSharpTest.Net.Collections.dll": {} - }, - "runtime": { - "lib/net40/CSharpTest.Net.Collections.dll": {} - } - }, "Microsoft.CSharp/4.5.0": { "type": "package", "compile": { @@ -70,21 +52,6 @@ } }, "libraries": { - "CSharpTest.Net.Collections/14.906.1403.1082": { - "sha512": "31Pu0wcHG2c814AUVPSzyL/ijcfyvu4S524+uxOhx2d1dRiIJ9eMLLvRWUhhP7F0Q17cvQpnGnZk8+4DhdJPgg==", - "type": "package", - "path": "csharptest.net.collections/14.906.1403.1082", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "csharptest.net.collections.14.906.1403.1082.nupkg.sha512", - "csharptest.net.collections.nuspec", - "lib/net20/CSharpTest.Net.Collections.XML", - "lib/net20/CSharpTest.Net.Collections.dll", - "lib/net40/CSharpTest.Net.Collections.XML", - "lib/net40/CSharpTest.Net.Collections.dll" - ] - }, "Microsoft.CSharp/4.5.0": { "sha512": "EGoBmf3Na2ppbhPePDE9PlX81r1HuOZH5twBrq7couJZiPTjUnD3648balerQJO6EJ8Sj+43+XuRwQ7r+3tE3w==", "type": "package", @@ -299,11 +266,9 @@ }, "projectFileDependencyGroups": { ".NETFramework,Version=v4.5.2": [ - "CSharpTest.Net.Collections >= 14.906.1403.1082", "Microsoft.CSharp >= 4.5.0" ], ".NETStandard,Version=v2.0": [ - "CSharpTest.Net.Collections >= 14.906.1403.1082", "Microsoft.CSharp >= 4.5.0", "NETStandard.Library >= 2.0.3" ] @@ -313,13 +278,13 @@ "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder": {} }, "project": { - "version": "1.2.1", + "version": "1.3.1", "restore": { - "projectUniqueName": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\Caching\\Caching.csproj", + "projectUniqueName": "C:\\code\\misc\\Caching\\Caching\\Caching.csproj", "projectName": "Caching.dll", - "projectPath": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\Caching\\Caching.csproj", + "projectPath": "C:\\code\\misc\\Caching\\Caching\\Caching.csproj", "packagesPath": "C:\\Users\\joelc\\.nuget\\packages\\", - "outputPath": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\Caching\\obj\\", + "outputPath": "C:\\code\\misc\\Caching\\Caching\\obj\\", "projectStyle": "PackageReference", "crossTargeting": true, "fallbackFolders": [ @@ -354,10 +319,6 @@ "frameworks": { "net452": { "dependencies": { - "CSharpTest.Net.Collections": { - "target": "Package", - "version": "[14.906.1403.1082, )" - }, "Microsoft.CSharp": { "target": "Package", "version": "[4.5.0, )" @@ -366,10 +327,6 @@ }, "netstandard2.0": { "dependencies": { - "CSharpTest.Net.Collections": { - "target": "Package", - "version": "[14.906.1403.1082, )" - }, "Microsoft.CSharp": { "target": "Package", "version": "[4.5.0, )" @@ -388,17 +345,5 @@ "warn": true } } - }, - "logs": [ - { - "code": "NU1701", - "level": "Warning", - "warningLevel": 1, - "message": "Package 'CSharpTest.Net.Collections 14.906.1403.1082' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETStandard,Version=v2.0'. This package may not be fully compatible with your project.", - "libraryId": "CSharpTest.Net.Collections", - "targetGraphs": [ - ".NETStandard,Version=v2.0" - ] - } - ] + } } \ No newline at end of file diff --git a/README.md b/README.md index 8f97160..ea36416 100644 --- a/README.md +++ b/README.md @@ -9,19 +9,13 @@ As of release 1.2.1, Caching.dll is now targeted to both .NET Core 2.0 and .NET [nuget]: https://www.nuget.org/packages/Caching.dll/ [nuget-img]: https://badge.fury.io/nu/Object.svg -The Caching library provides a simple implementation of a FIFO cache (first-in-first-out) and two LRU (least-recently-used) caches, one based on a dictionary and the second based on a BTree (CSharpTest.Net.Collections). It is written in C# and is designed to be thread-safe. +The Caching library provides a simple implementation of a FIFO cache (first-in-first-out) and an LRU (least-recently-used) cache. It is written in C# and is designed to be thread-safe. Three projects are included in the solution: - Caching: the cache classes - TestNetFramework: a simple test client for .NET Framework 4.5.2 - TestNetCore: a simple test client for .NET Core 2.0 - -Three caches are included; the use case for each is also listed: - -- FIFOCache - First-in, first-out cache using a dictionary internally -- LRUCache - Least-recently used cache with a dictionary internally -- LRUCacheBTree - uses a BTree (from CSharpTest.Net.Collections), suitable for larger cache sizes ## Usage @@ -39,8 +33,7 @@ class Person } FIFOCache cache = new FIFOCache(capacity, evictCount, debug); -LRUCache cache = new LRUCache(capacity, evictCount, debug) -LRUCacheBTree cache = new LRUCacheBTree(capacity, evictCount, debug); +LRUCache cache = new LRUCache(capacity, evictCount, debug) // T1 is the type of the key // T2 is the type of the value diff --git a/TestNetCore/Program.LRUCacheBTreeTest.cs b/TestNetCore/Program.LRUCacheBTreeTest.cs deleted file mode 100644 index 3de3dc9..0000000 --- a/TestNetCore/Program.LRUCacheBTreeTest.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Caching; - -namespace TestNetCore -{ - partial class Program - { - static void LRUCacheBTreeTest() - { - try - { - bool runForever = true; - int capacity = 2048; - int evictCount = 512; - int loadCount = 256; - bool cacheDebug = true; - int dataLen = 4096; - byte[] data = InitByteArray(dataLen, 0x00); - byte[] keyData; - - LRUCacheBTree cache = new LRUCacheBTree(capacity, evictCount, cacheDebug); - Thread.Sleep(250); - - while (runForever) - { - Console.WriteLine("-------------------------------------------------------------------------------"); - Console.WriteLine("Available commands (LRU Cache BTree Test):"); - Console.WriteLine(" get Get entry by key"); - Console.WriteLine(" load Load " + loadCount + " new records"); - Console.WriteLine(" last_used Get the last used entry"); - Console.WriteLine(" first_used Get the first used entry"); - Console.WriteLine(" oldest Get the oldest entry"); - Console.WriteLine(" newest Get the newest entry"); - Console.WriteLine(" count Get the count of cached entries"); - Console.WriteLine(" clear Clear the cache"); - Console.WriteLine(" quit Exit the application"); - Console.WriteLine(" debug Flip the cache debug flag (currently " + cache.Debug + ")"); - - Console.WriteLine(""); - Console.Write("Command > "); - string userInput = Console.ReadLine(); - if (String.IsNullOrEmpty(userInput)) continue; - - switch (userInput.ToLower()) - { - case "get": - Console.Write("Key > "); - string getKey = Console.ReadLine(); - if (String.IsNullOrEmpty(getKey)) break; - if (cache.TryGet(getKey, out keyData)) Console.WriteLine("Cache hit"); - else Console.WriteLine("Cache miss"); - break; - - case "load": - DateTime startTime = DateTime.Now; - - for (int i = 0; i < loadCount; i++) - { - string loadKey = Guid.NewGuid().ToString(); - Console.Write("Adding entry " + i + " of " + loadCount + " \r"); - cache.AddReplace(loadKey, data); - } - - Console.WriteLine( - "Loaded " + loadCount + - " records in " + TotalTimeFrom(startTime) + ": " + - DecimalToString(TotalMsFrom(startTime) / loadCount) + "ms per entry"); - break; - - case "last_used": - Console.WriteLine("Last used key: " + cache.LastUsed()); - break; - - case "first_used": - Console.WriteLine("First used key: " + cache.FirstUsed()); - break; - - case "oldest": - Console.WriteLine("Oldest key: " + cache.Oldest()); - break; - - case "newest": - Console.WriteLine("Newest key: " + cache.Newest()); - break; - - case "count": - Console.WriteLine("Cache count: " + cache.Count()); - break; - - case "clear": - cache.Clear(); - Console.WriteLine("Cache cleared"); - break; - - case "q": - case "quit": - runForever = false; - break; - - case "debug": - cache.Debug = !cache.Debug; - break; - - default: - continue; - } - } - - Console.WriteLine("Goodbye!"); - return; - } - catch (Exception e) - { - PrintException(e); - } - finally - { - Console.WriteLine(""); - Console.Write("Press ENTER to exit."); - Console.ReadLine(); - } - } - } -} \ No newline at end of file diff --git a/TestNetCore/Program.cs b/TestNetCore/Program.cs index 8624720..adff466 100644 --- a/TestNetCore/Program.cs +++ b/TestNetCore/Program.cs @@ -17,8 +17,7 @@ static void Main(string[] args) Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine("Select which cache you wish to test"); Console.WriteLine(" fifo"); - Console.WriteLine(" lru"); - Console.WriteLine(" lrubtree"); + Console.WriteLine(" lru"); Console.WriteLine(""); Console.Write("Selection > "); string userInput = Console.ReadLine(); @@ -35,12 +34,7 @@ static void Main(string[] args) LRUCacheTest(); runForever = false; break; - - case "lrubtree": - LRUCacheBTreeTest(); - runForever = false; - break; - + default: continue; } diff --git a/TestNetCore/bin/Release/netcoreapp2.2/Caching.dll b/TestNetCore/bin/Release/netcoreapp2.2/Caching.dll index a722c6d..c498efd 100644 Binary files a/TestNetCore/bin/Release/netcoreapp2.2/Caching.dll and b/TestNetCore/bin/Release/netcoreapp2.2/Caching.dll differ diff --git a/TestNetCore/bin/Release/netcoreapp2.2/Caching.pdb b/TestNetCore/bin/Release/netcoreapp2.2/Caching.pdb index bdfe58f..9e4112f 100644 Binary files a/TestNetCore/bin/Release/netcoreapp2.2/Caching.pdb and b/TestNetCore/bin/Release/netcoreapp2.2/Caching.pdb differ diff --git a/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.deps.json b/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.deps.json index f022311..f5199b7 100644 --- a/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.deps.json +++ b/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.deps.json @@ -1,31 +1,22 @@ { "runtimeTarget": { "name": ".NETCoreApp,Version=v2.2", - "signature": "1b378ed4e3a3e4ee7d406db82557a8452e321588" + "signature": "ddfaeae436e140dd5647a8209cb2004484674069" }, "compilationOptions": {}, "targets": { ".NETCoreApp,Version=v2.2": { "TestNetCore/1.0.0": { "dependencies": { - "Caching.dll": "1.2.1" + "Caching.dll": "1.3.1" }, "runtime": { "TestNetCore.dll": {} } }, - "CSharpTest.Net.Collections/14.906.1403.1082": { - "runtime": { - "lib/net40/CSharpTest.Net.Collections.dll": { - "assemblyVersion": "14.906.1403.1082", - "fileVersion": "14.906.1403.1082" - } - } - }, "Microsoft.CSharp/4.5.0": {}, - "Caching.dll/1.2.1": { + "Caching.dll/1.3.1": { "dependencies": { - "CSharpTest.Net.Collections": "14.906.1403.1082", "Microsoft.CSharp": "4.5.0" }, "runtime": { @@ -40,13 +31,6 @@ "serviceable": false, "sha512": "" }, - "CSharpTest.Net.Collections/14.906.1403.1082": { - "type": "package", - "serviceable": true, - "sha512": "sha512-31Pu0wcHG2c814AUVPSzyL/ijcfyvu4S524+uxOhx2d1dRiIJ9eMLLvRWUhhP7F0Q17cvQpnGnZk8+4DhdJPgg==", - "path": "csharptest.net.collections/14.906.1403.1082", - "hashPath": "csharptest.net.collections.14.906.1403.1082.nupkg.sha512" - }, "Microsoft.CSharp/4.5.0": { "type": "package", "serviceable": true, @@ -54,7 +38,7 @@ "path": "microsoft.csharp/4.5.0", "hashPath": "microsoft.csharp.4.5.0.nupkg.sha512" }, - "Caching.dll/1.2.1": { + "Caching.dll/1.3.1": { "type": "project", "serviceable": false, "sha512": "" diff --git a/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.dll b/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.dll index 51af331..76fa7ec 100644 Binary files a/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.dll and b/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.dll differ diff --git a/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.pdb b/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.pdb index 4195fc1..3a327f2 100644 Binary files a/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.pdb and b/TestNetCore/bin/Release/netcoreapp2.2/TestNetCore.pdb differ diff --git a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.assets.cache b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.assets.cache index b340c7f..9921efd 100644 Binary files a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.assets.cache and b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.assets.cache differ diff --git a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.CoreCompileInputs.cache b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.CoreCompileInputs.cache index c9ffd57..942c63a 100644 --- a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.CoreCompileInputs.cache +++ b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -2fe119bbec51e4e0c9e94028145798e8d493b5a9 +ddd30bebd7e9a0f8fa785b3edb6a9a4a4b735ec5 diff --git a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.FileListAbsolute.txt b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.FileListAbsolute.txt index 11af790..4f2f263 100644 --- a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.FileListAbsolute.txt +++ b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csproj.FileListAbsolute.txt @@ -12,3 +12,17 @@ C:\Code\Misc\CachingWithBtreeRetarget\TestNetCore\obj\Release\netcoreapp2.2\Test C:\Code\Misc\CachingWithBtreeRetarget\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.csproj.CopyComplete C:\Code\Misc\CachingWithBtreeRetarget\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.dll C:\Code\Misc\CachingWithBtreeRetarget\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.pdb +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\TestNetCore.deps.json +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\TestNetCore.runtimeconfig.json +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\TestNetCore.runtimeconfig.dev.json +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\TestNetCore.dll +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\TestNetCore.pdb +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\Caching.dll +C:\code\misc\Caching\TestNetCore\bin\Release\netcoreapp2.2\Caching.pdb +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.csprojAssemblyReference.cache +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.csproj.CoreCompileInputs.cache +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.AssemblyInfoInputs.cache +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.AssemblyInfo.cs +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.csproj.CopyComplete +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.dll +C:\code\misc\Caching\TestNetCore\obj\Release\netcoreapp2.2\TestNetCore.pdb diff --git a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csprojAssemblyReference.cache b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csprojAssemblyReference.cache index aa17d69..024ab24 100644 Binary files a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csprojAssemblyReference.cache and b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.csprojAssemblyReference.cache differ diff --git a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.dll b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.dll index 51af331..76fa7ec 100644 Binary files a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.dll and b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.dll differ diff --git a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.pdb b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.pdb index 4195fc1..3a327f2 100644 Binary files a/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.pdb and b/TestNetCore/obj/Release/netcoreapp2.2/TestNetCore.pdb differ diff --git a/TestNetCore/obj/TestNetCore.csproj.nuget.cache b/TestNetCore/obj/TestNetCore.csproj.nuget.cache index 41d4f73..c58c88c 100644 --- a/TestNetCore/obj/TestNetCore.csproj.nuget.cache +++ b/TestNetCore/obj/TestNetCore.csproj.nuget.cache @@ -1,5 +1,5 @@ { "version": 1, - "dgSpecHash": "W7wumci2En8WnkeSB5odwoBziBOPOH20Nkug2W/nECmJv64lZfkYFKDovKNCgBGnL2CayaMjoa9FS3T7vV6Hmg==", + "dgSpecHash": "W49KgS89g2a9mY3NXOzX1d2Uo/ijYP2GQDCTrKzfnK11uGq8a3Bu0EI25iDH/uGQswy2r1IviIkZFIKd+zn+8A==", "success": true } \ No newline at end of file diff --git a/TestNetCore/obj/TestNetCore.csproj.nuget.g.props b/TestNetCore/obj/TestNetCore.csproj.nuget.g.props index 16747f0..1b847bb 100644 --- a/TestNetCore/obj/TestNetCore.csproj.nuget.g.props +++ b/TestNetCore/obj/TestNetCore.csproj.nuget.g.props @@ -3,7 +3,7 @@ True NuGet - C:\Code\Misc\CachingWithBtreeRetarget\TestNetCore\obj\project.assets.json + C:\code\misc\Caching\TestNetCore\obj\project.assets.json $(UserProfile)\.nuget\packages\ C:\Users\joelc\.nuget\packages\;C:\Program Files\dotnet\sdk\NuGetFallbackFolder PackageReference diff --git a/TestNetCore/obj/project.assets.json b/TestNetCore/obj/project.assets.json index 4bf08ef..84b385d 100644 --- a/TestNetCore/obj/project.assets.json +++ b/TestNetCore/obj/project.assets.json @@ -2,15 +2,6 @@ "version": 3, "targets": { ".NETCoreApp,Version=v2.2": { - "CSharpTest.Net.Collections/14.906.1403.1082": { - "type": "package", - "compile": { - "lib/net40/CSharpTest.Net.Collections.dll": {} - }, - "runtime": { - "lib/net40/CSharpTest.Net.Collections.dll": {} - } - }, "Microsoft.CSharp/4.5.0": { "type": "package", "compile": { @@ -226,11 +217,10 @@ "build/netstandard2.0/NETStandard.Library.targets": {} } }, - "Caching.dll/1.2.1": { + "Caching.dll/1.3.1": { "type": "project", "framework": ".NETStandard,Version=v2.0", "dependencies": { - "CSharpTest.Net.Collections": "14.906.1403.1082", "Microsoft.CSharp": "4.5.0" }, "compile": { @@ -243,21 +233,6 @@ } }, "libraries": { - "CSharpTest.Net.Collections/14.906.1403.1082": { - "sha512": "31Pu0wcHG2c814AUVPSzyL/ijcfyvu4S524+uxOhx2d1dRiIJ9eMLLvRWUhhP7F0Q17cvQpnGnZk8+4DhdJPgg==", - "type": "package", - "path": "csharptest.net.collections/14.906.1403.1082", - "files": [ - ".nupkg.metadata", - ".signature.p7s", - "csharptest.net.collections.14.906.1403.1082.nupkg.sha512", - "csharptest.net.collections.nuspec", - "lib/net20/CSharpTest.Net.Collections.XML", - "lib/net20/CSharpTest.Net.Collections.dll", - "lib/net40/CSharpTest.Net.Collections.XML", - "lib/net40/CSharpTest.Net.Collections.dll" - ] - }, "Microsoft.CSharp/4.5.0": { "sha512": "EGoBmf3Na2ppbhPePDE9PlX81r1HuOZH5twBrq7couJZiPTjUnD3648balerQJO6EJ8Sj+43+XuRwQ7r+3tE3w==", "type": "package", @@ -794,7 +769,7 @@ "netstandard.library.nuspec" ] }, - "Caching.dll/1.2.1": { + "Caching.dll/1.3.1": { "type": "project", "path": "../Caching/Caching.csproj", "msbuildProject": "../Caching/Caching.csproj" @@ -802,7 +777,7 @@ }, "projectFileDependencyGroups": { ".NETCoreApp,Version=v2.2": [ - "Caching.dll >= 1.2.1", + "Caching.dll >= 1.3.1", "Microsoft.NETCore.App >= 2.2.0" ] }, @@ -813,11 +788,11 @@ "project": { "version": "1.0.0", "restore": { - "projectUniqueName": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\TestNetCore\\TestNetCore.csproj", + "projectUniqueName": "C:\\code\\misc\\Caching\\TestNetCore\\TestNetCore.csproj", "projectName": "TestNetCore", - "projectPath": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\TestNetCore\\TestNetCore.csproj", + "projectPath": "C:\\code\\misc\\Caching\\TestNetCore\\TestNetCore.csproj", "packagesPath": "C:\\Users\\joelc\\.nuget\\packages\\", - "outputPath": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\TestNetCore\\obj\\", + "outputPath": "C:\\code\\misc\\Caching\\TestNetCore\\obj\\", "projectStyle": "PackageReference", "fallbackFolders": [ "C:\\Program Files\\dotnet\\sdk\\NuGetFallbackFolder" @@ -836,8 +811,8 @@ "frameworks": { "netcoreapp2.2": { "projectReferences": { - "C:\\Code\\Misc\\CachingWithBtreeRetarget\\Caching\\Caching.csproj": { - "projectPath": "C:\\Code\\Misc\\CachingWithBtreeRetarget\\Caching\\Caching.csproj" + "C:\\code\\misc\\Caching\\Caching\\Caching.csproj": { + "projectPath": "C:\\code\\misc\\Caching\\Caching\\Caching.csproj" } } } @@ -865,17 +840,5 @@ "warn": true } } - }, - "logs": [ - { - "code": "NU1701", - "level": "Warning", - "warningLevel": 1, - "message": "Package 'CSharpTest.Net.Collections 14.906.1403.1082' was restored using '.NETFramework,Version=v4.6.1' instead of the project target framework '.NETCoreApp,Version=v2.2'. This package may not be fully compatible with your project.", - "libraryId": "CSharpTest.Net.Collections", - "targetGraphs": [ - ".NETCoreApp,Version=v2.2" - ] - } - ] + } } \ No newline at end of file diff --git a/TestNetFramework/Program.LRUCacheBTreeTest.cs b/TestNetFramework/Program.LRUCacheBTreeTest.cs deleted file mode 100644 index e34d62f..0000000 --- a/TestNetFramework/Program.LRUCacheBTreeTest.cs +++ /dev/null @@ -1,129 +0,0 @@ -using System; -using System.Collections.Generic; -using System.Linq; -using System.Text; -using System.Threading; -using System.Threading.Tasks; -using Caching; - -namespace TestNetFramework -{ - partial class Program - { - static void LRUCacheBTreeTest() - { - try - { - bool runForever = true; - int capacity = 2048; - int evictCount = 512; - int loadCount = 256; - bool cacheDebug = true; - int dataLen = 4096; - byte[] data = InitByteArray(dataLen, 0x00); - byte[] keyData; - - LRUCacheBTree cache = new LRUCacheBTree(capacity, evictCount, cacheDebug); - Thread.Sleep(250); - - while (runForever) - { - Console.WriteLine("-------------------------------------------------------------------------------"); - Console.WriteLine("Available commands (LRU Cache BTree Test):"); - Console.WriteLine(" get Get entry by key"); - Console.WriteLine(" load Load " + loadCount + " new records"); - Console.WriteLine(" last_used Get the last used entry"); - Console.WriteLine(" first_used Get the first used entry"); - Console.WriteLine(" oldest Get the oldest entry"); - Console.WriteLine(" newest Get the newest entry"); - Console.WriteLine(" count Get the count of cached entries"); - Console.WriteLine(" clear Clear the cache"); - Console.WriteLine(" quit Exit the application"); - Console.WriteLine(" debug Flip the cache debug flag (currently " + cache.Debug + ")"); - - Console.WriteLine(""); - Console.Write("Command > "); - string userInput = Console.ReadLine(); - if (String.IsNullOrEmpty(userInput)) continue; - - switch (userInput.ToLower()) - { - case "get": - Console.Write("Key > "); - string getKey = Console.ReadLine(); - if (String.IsNullOrEmpty(getKey)) break; - if (cache.TryGet(getKey, out keyData)) Console.WriteLine("Cache hit"); - else Console.WriteLine("Cache miss"); - break; - - case "load": - DateTime startTime = DateTime.Now; - - for (int i = 0; i < loadCount; i++) - { - string loadKey = Guid.NewGuid().ToString(); - Console.Write("Adding entry " + i + " of " + loadCount + " \r"); - cache.AddReplace(loadKey, data); - } - - Console.WriteLine( - "Loaded " + loadCount + - " records in " + TotalTimeFrom(startTime) + ": " + - DecimalToString(TotalMsFrom(startTime) / loadCount) + "ms per entry"); - break; - - case "last_used": - Console.WriteLine("Last used key: " + cache.LastUsed()); - break; - - case "first_used": - Console.WriteLine("First used key: " + cache.FirstUsed()); - break; - - case "oldest": - Console.WriteLine("Oldest key: " + cache.Oldest()); - break; - - case "newest": - Console.WriteLine("Newest key: " + cache.Newest()); - break; - - case "count": - Console.WriteLine("Cache count: " + cache.Count()); - break; - - case "clear": - cache.Clear(); - Console.WriteLine("Cache cleared"); - break; - - case "q": - case "quit": - runForever = false; - break; - - case "debug": - cache.Debug = !cache.Debug; - break; - - default: - continue; - } - } - - Console.WriteLine("Goodbye!"); - return; - } - catch (Exception e) - { - PrintException(e); - } - finally - { - Console.WriteLine(""); - Console.Write("Press ENTER to exit."); - Console.ReadLine(); - } - } - } -} \ No newline at end of file diff --git a/TestNetFramework/Program.cs b/TestNetFramework/Program.cs index 43aa6c2..7147741 100644 --- a/TestNetFramework/Program.cs +++ b/TestNetFramework/Program.cs @@ -17,8 +17,7 @@ static void Main(string[] args) Console.WriteLine("-------------------------------------------------------------------------------"); Console.WriteLine("Select which cache you wish to test"); Console.WriteLine(" fifo"); - Console.WriteLine(" lru"); - Console.WriteLine(" lrubtree"); + Console.WriteLine(" lru"); Console.WriteLine(""); Console.Write("Selection > "); string userInput = Console.ReadLine(); @@ -35,12 +34,7 @@ static void Main(string[] args) LRUCacheTest(); runForever = false; break; - - case "lrubtree": - LRUCacheBTreeTest(); - runForever = false; - break; - + default: continue; } diff --git a/TestNetFramework/TestNetFramework.csproj b/TestNetFramework/TestNetFramework.csproj index fcd4dd0..c0ca3f6 100644 --- a/TestNetFramework/TestNetFramework.csproj +++ b/TestNetFramework/TestNetFramework.csproj @@ -43,7 +43,6 @@ - diff --git a/TestNetFramework/bin/Release/CSharpTest.Net.Collections.dll b/TestNetFramework/bin/Release/CSharpTest.Net.Collections.dll deleted file mode 100644 index a93fdec..0000000 Binary files a/TestNetFramework/bin/Release/CSharpTest.Net.Collections.dll and /dev/null differ diff --git a/TestNetFramework/bin/Release/Caching.dll b/TestNetFramework/bin/Release/Caching.dll index b42b7c0..d5e8dcc 100644 Binary files a/TestNetFramework/bin/Release/Caching.dll and b/TestNetFramework/bin/Release/Caching.dll differ diff --git a/TestNetFramework/bin/Release/Caching.pdb b/TestNetFramework/bin/Release/Caching.pdb index af9fb3b..5447cb3 100644 Binary files a/TestNetFramework/bin/Release/Caching.pdb and b/TestNetFramework/bin/Release/Caching.pdb differ diff --git a/TestNetFramework/bin/Release/CachingTest.exe b/TestNetFramework/bin/Release/CachingTest.exe index 350a09a..aaf949a 100644 Binary files a/TestNetFramework/bin/Release/CachingTest.exe and b/TestNetFramework/bin/Release/CachingTest.exe differ diff --git a/TestNetFramework/bin/Release/CachingTest.pdb b/TestNetFramework/bin/Release/CachingTest.pdb index bd47b2a..32ba968 100644 Binary files a/TestNetFramework/bin/Release/CachingTest.pdb and b/TestNetFramework/bin/Release/CachingTest.pdb differ diff --git a/TestNetFramework/obj/Release/CachingTest.exe b/TestNetFramework/obj/Release/CachingTest.exe index 350a09a..aaf949a 100644 Binary files a/TestNetFramework/obj/Release/CachingTest.exe and b/TestNetFramework/obj/Release/CachingTest.exe differ diff --git a/TestNetFramework/obj/Release/CachingTest.pdb b/TestNetFramework/obj/Release/CachingTest.pdb index bd47b2a..32ba968 100644 Binary files a/TestNetFramework/obj/Release/CachingTest.pdb and b/TestNetFramework/obj/Release/CachingTest.pdb differ diff --git a/TestNetFramework/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache b/TestNetFramework/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache index 80a9d86..b336a00 100644 Binary files a/TestNetFramework/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache and b/TestNetFramework/obj/Release/DesignTimeResolveAssemblyReferencesInput.cache differ diff --git a/TestNetFramework/obj/Release/TestNetFramework.csproj.CoreCompileInputs.cache b/TestNetFramework/obj/Release/TestNetFramework.csproj.CoreCompileInputs.cache index 06a0078..425bb1f 100644 --- a/TestNetFramework/obj/Release/TestNetFramework.csproj.CoreCompileInputs.cache +++ b/TestNetFramework/obj/Release/TestNetFramework.csproj.CoreCompileInputs.cache @@ -1 +1 @@ -f0b7ebe5b02fcd19db45a29af05caea98810f35e +17c60fa043dc9b32aef4c48ec8b674913567a828 diff --git a/TestNetFramework/obj/Release/TestNetFramework.csproj.FileListAbsolute.txt b/TestNetFramework/obj/Release/TestNetFramework.csproj.FileListAbsolute.txt index 4062767..ed48acb 100644 --- a/TestNetFramework/obj/Release/TestNetFramework.csproj.FileListAbsolute.txt +++ b/TestNetFramework/obj/Release/TestNetFramework.csproj.FileListAbsolute.txt @@ -9,3 +9,13 @@ C:\Code\Misc\CachingWithBtreeRetarget\TestNetFramework\obj\Release\TestNetFramew C:\Code\Misc\CachingWithBtreeRetarget\TestNetFramework\obj\Release\TestNetFramework.csproj.CopyComplete C:\Code\Misc\CachingWithBtreeRetarget\TestNetFramework\obj\Release\CachingTest.exe C:\Code\Misc\CachingWithBtreeRetarget\TestNetFramework\obj\Release\CachingTest.pdb +C:\code\misc\Caching\TestNetFramework\bin\Release\CachingTest.exe.config +C:\code\misc\Caching\TestNetFramework\bin\Release\CachingTest.exe +C:\code\misc\Caching\TestNetFramework\bin\Release\CachingTest.pdb +C:\code\misc\Caching\TestNetFramework\bin\Release\Caching.dll +C:\code\misc\Caching\TestNetFramework\bin\Release\Caching.pdb +C:\code\misc\Caching\TestNetFramework\obj\Release\TestNetFramework.csprojAssemblyReference.cache +C:\code\misc\Caching\TestNetFramework\obj\Release\TestNetFramework.csproj.CoreCompileInputs.cache +C:\code\misc\Caching\TestNetFramework\obj\Release\TestNetFramework.csproj.CopyComplete +C:\code\misc\Caching\TestNetFramework\obj\Release\CachingTest.exe +C:\code\misc\Caching\TestNetFramework\obj\Release\CachingTest.pdb diff --git a/TestNetFramework/obj/Release/TestNetFramework.csprojAssemblyReference.cache b/TestNetFramework/obj/Release/TestNetFramework.csprojAssemblyReference.cache index f9e2f55..bf90c6e 100644 Binary files a/TestNetFramework/obj/Release/TestNetFramework.csprojAssemblyReference.cache and b/TestNetFramework/obj/Release/TestNetFramework.csprojAssemblyReference.cache differ