Palash.Cachify 1.0.0

There is a newer version of this package available.
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                
#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                

Cachify

  1. Microsoft.Extensions.Caching.Distributed.IDistributedCache implementation with optional persistence of data.
  2. 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 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.

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
3.0.3 153 3/23/2023
3.0.2 135 3/22/2023
3.0.1 147 3/22/2023 3.0.1 is deprecated because it is no longer maintained and has critical bugs.
3.0.0 127 3/22/2023
2.0.0 127 3/22/2023
1.1.0 126 3/22/2023
1.0.2 127 3/21/2023
1.0.1 127 3/20/2023
1.0.0 126 3/19/2023