Hanson.Cache.Mongodb 1.0.0

dotnet add package Hanson.Cache.Mongodb --version 1.0.0                
NuGet\Install-Package Hanson.Cache.Mongodb -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="Hanson.Cache.Mongodb" Version="1.0.0" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add Hanson.Cache.Mongodb --version 1.0.0                
#r "nuget: Hanson.Cache.Mongodb, 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 Hanson.Cache.Mongodb as a Cake Addin
#addin nuget:?package=Hanson.Cache.Mongodb&version=1.0.0

// Install Hanson.Cache.Mongodb as a Cake Tool
#tool nuget:?package=Hanson.Cache.Mongodb&version=1.0.0                

README

Hanson.Cache.Mongodb

  • 主要功能

    1. 提供 Mongodb 方式的 Cache 功能

      • ReadCache
      • WriteCache
      • RemoveCache
    2. 提供三種快取資料效期

      • 永久有效
      • 指定日期前有效
      • 滑動時間內有效

    前置條件

    • 開發環境需具備 .Net 6.0 or .Net Core 3.1 or NET 472 or NET 462

    • 運行於 Windows Platform (x86, x64)

    • 運行於 Linux Platform (x86, x64)

    • 運行於 OSX Platform (x64)

    • 運行於 Raspberry PI Platform (x86)

    安裝方式

    授權

    此專案採用的 License為 Apache-2.0

    使用範例

    命名空間

    using Hanson.Cache.Utils;
    
    • 基本快取使用範本
    private void Sample()
    {
        string uri = "mongodb://user:pw@127.0.0.1:27017";
      ICache cache = MongoCache.CreateInstance(uri);
    
        //使用預設資料效期 (NoExpiration)
        int writeCount = cache.WriteCache("default", "資料永久有效");
    
        //讀取指定 Key 的快取資料
        CacheInfo data = cache.ReadCache("default");
        Console.WriteLine($"key:{data.Key},value:{data.Value}");
    
        //移除指定 Key 的快取資料
        int removeCount = cache.RemoveCache("default");
    
        cache.Dispose();
    }
    
    • 指定資料效期範本
    private void Sample()
    {
        string uri = "mongodb://user:pw@127.0.0.1:27017";
      ICache cache = MongoCache.CreateInstance(uri);
        //使用 NoExpiration
        cache.WriteCache("NoExpiration", "資料永久有效",Option.NoExpiration());
        //使用 AbsoluteExpiration 
        cache.WriteCache("AbsoluteExpiration", "資料在7天後失效", Option.AbsoluteExpiration(DateTime.Now.AddDays(7)));
        //使用 SlidingExpiration
        cache.WriteCache("key", "資料在60秒後失效", Option.SlidingExpiration(60));
    
        cache.Dispose();
    }
    
Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  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 netcoreapp3.1 is compatible. 
.NET Framework net462 is compatible.  net463 was computed.  net47 was computed.  net471 was computed.  net472 is compatible.  net48 was computed.  net481 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
1.0.0 142 3/6/2024