Palash.Cachify
1.0.0
There is a newer version of this package available.
See the version list below for details.
See the version list below for details.
dotnet add package Palash.Cachify --version 1.0.0
NuGet\Install-Package Palash.Cachify -Version 1.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="Palash.Cachify" Version="1.0.0" />
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Palash.Cachify --version 1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
#r "nuget: Palash.Cachify, 1.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 Palash.Cachify as a Cake Addin #addin nuget:?package=Palash.Cachify&version=1.0.0 // Install Palash.Cachify as a Cake Tool #tool nuget:?package=Palash.Cachify&version=1.0.0
The NuGet Team does not provide support for this client. Please contact its maintainers for support.
Cachify
- Microsoft.Extensions.Caching.Distributed.IDistributedCache implementation with optional persistence of data.
- Generic version of the above (slightly different)
Usage 1:
using Microsoft.VisualStudio.TestTools.UnitTesting;
using System.Text.Json;
namespace Cachify.Tests;
[TestClass()]
public class CacheTests
{
private LiteBinCache cache;
[TestInitialize]
public void Init()
{
string path = @"C:\LiteDB_Store\test_cache.db";
cache = new($"FileName={path};Connection=shared");
}
[TestMethod()]
public void SetAsyncTest()
{
Rec r = new(Guid.NewGuid(), "Palash");
byte[] bin = JsonSerializer.SerializeToUtf8Bytes(r);
cache.SetAsync(r.Name, bin).Wait();
byte[] bin2 = cache.GetAsync(r.Name).Result ?? Array.Empty<byte>();
using var ms = new MemoryStream(bin2);
Rec? r2 = JsonSerializer.Deserialize<Rec>(ms);
Assert.AreEqual(r, r2);
}
}
Usage 2:
using Microsoft.VisualStudio.TestTools.UnitTesting;
namespace Cachify.Tests
{
[TestClass()]
public class LiteCacheTests
{
private LiteCache cache;
[TestInitialize]
public void Init()
{
string path = @"C:\LiteDB_Store\test_cache.db";
cache = new($"FileName={path};Connection=shared");
}
[TestMethod()]
public void SetAsyncTest()
{
Rec r = new(Guid.NewGuid(), "Palash Generic");
cache.SetAsync(r.Name, r).Wait();
var r2 = cache.GetAsync<Rec>(r.Name).Result;
Assert.AreEqual(r, r2);
}
}
}
Product | Versions Compatible and additional computed target framework versions. |
---|---|
.NET | net8.0 is compatible. 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. |
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.
-
net8.0
- LiteDB (>= 5.0.16)
- LiteDB.Async (>= 0.1.6)
- Microsoft.Extensions.Caching.Abstractions (>= 8.0.0-preview.2.23128.3)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.