Pustalorc.FrequencyCache
1.2.0
See the version list below for details.
dotnet add package Pustalorc.FrequencyCache --version 1.2.0
NuGet\Install-Package Pustalorc.FrequencyCache -Version 1.2.0
<PackageReference Include="Pustalorc.FrequencyCache" Version="1.2.0" />
paket add Pustalorc.FrequencyCache --version 1.2.0
#r "nuget: Pustalorc.FrequencyCache, 1.2.0"
// Install Pustalorc.FrequencyCache as a Cake Addin #addin nuget:?package=Pustalorc.FrequencyCache&version=1.2.0 // Install Pustalorc.FrequencyCache as a Cake Tool #tool nuget:?package=Pustalorc.FrequencyCache&version=1.2.0
First, create a class that inherits from ICacheConfiguration
like so:
public class ExampleConfiguration : ICacheConfiguration
{
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 CacheManager<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 CacheManager<T1, T2>(configuration);
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 | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net5.0 is compatible. net5.0-windows was computed. net6.0 was computed. 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 | net40 is compatible. net403 was computed. net45 was computed. net451 was computed. net452 was computed. net46 was computed. 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. |
-
.NETFramework 4.0
- JetBrains.Annotations (>= 2021.2.0)
-
.NETFramework 4.6.1
- JetBrains.Annotations (>= 2021.2.0)
-
.NETFramework 4.8
- JetBrains.Annotations (>= 2021.2.0)
-
.NETStandard 2.0
- JetBrains.Annotations (>= 2021.2.0)
-
.NETStandard 2.1
- JetBrains.Annotations (>= 2021.2.0)
-
net5.0
- JetBrains.Annotations (>= 2021.2.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
Modifies the cache to support specific type caches with generics in mind. IIdentifiable can be used still as the cache type, which allows all types.