Pustalorc.FrequencyCache 2.0.0

dotnet add package Pustalorc.FrequencyCache --version 2.0.0
NuGet\Install-Package Pustalorc.FrequencyCache -Version 2.0.0
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Pustalorc.FrequencyCache" Version="2.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Pustalorc.FrequencyCache --version 2.0.0
#r "nuget: Pustalorc.FrequencyCache, 2.0.0"
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
// Install Pustalorc.FrequencyCache as a Cake Addin
#addin nuget:?package=Pustalorc.FrequencyCache&version=2.0.0

// Install Pustalorc.FrequencyCache as a Cake Tool
#tool nuget:?package=Pustalorc.FrequencyCache&version=2.0.0

First, create a class that inherits from ICacheConfiguration like so:

public class ExampleConfiguration : ICacheConfiguration
{
    public bool EnableCacheRefreshes => true;
    public double CacheRefreshRequestInterval => 1500;
    public ulong CacheSize => 15;
}

This will be used to configure the cache to function in a specific way.

Next, create a new instance of the Cache<T1, T2> class and pass it an instance of the previous class you created. Make sure to define T1 as the class that you wish to cache, and T2 as the class of the key that will identify T1 when doing lookups in the cache.

configuration = new ExampleConfiguration;
cache = new Cache<T1, T2>(configuration, StringComparer.OrdinalIgnoreCase);

Important Note: As of 1.2.x, a comparer is required to compare T2 in the lookup dictionary.

And you are done!

You can now use cache.GetItemInCache(T2) to lookup an item in cache, or cache.StoreUpdateItem(T2, T1) to store or update any item in the cache. For example:

configuration = new ExampleConfiguration;
cache = new CacheManager<Query, string>(configuration, StringComparer.OrdinalIgnoreCase);
cache.StoreUpdateItem("TableLookup", new Query("SELECT * FROM TABLE `users`;"));

var cachedElement = cache.GetItemInCache("TableLookup");
var query = cachedElement.Item;
query.String = "SELECT * FROM TABLE `users` WHERE `name`='admin';";
Product Compatible and additional computed target framework versions.
.NET net5.0 is compatible.  net5.0-windows was computed.  net6.0 is compatible.  net6.0-android was computed.  net6.0-ios was computed.  net6.0-maccatalyst was computed.  net6.0-macos was computed.  net6.0-tvos was computed.  net6.0-windows was computed.  net7.0 was computed.  net7.0-android was computed.  net7.0-ios was computed.  net7.0-maccatalyst was computed.  net7.0-macos was computed.  net7.0-tvos was computed.  net7.0-windows was computed.  net8.0 was computed.  net8.0-android was computed.  net8.0-browser was computed.  net8.0-ios was computed.  net8.0-maccatalyst was computed.  net8.0-macos was computed.  net8.0-tvos was computed.  net8.0-windows was computed. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 is compatible. 
.NET Framework net461 is compatible.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 is compatible.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

NuGet packages

This package is not used by any NuGet packages.

GitHub repositories

This package is not used by any popular GitHub repositories.

Version Downloads Last updated
2.0.0 486 2/8/2022
1.2.2 428 2/8/2022
1.2.1 449 12/17/2021
1.2.0 629 9/23/2021
1.1.0 670 8/1/2020
1.0.2 617 7/9/2020
1.0.0 680 7/7/2020

Switched to properties rather than fields on the cache.
           Added new ReloadConfiguration method.
           Made Dispose virtual.
           Updated some of the Xml Documentation.
           Removed ModifyCacheRefreshInterval.
           Removed default/example configuration.