CodeDesignPlus.Net.Redis.Cache 0.5.0-beta.56

This is a prerelease version of CodeDesignPlus.Net.Redis.Cache.
There is a newer prerelease version of this package available.
See the version list below for details.
dotnet add package CodeDesignPlus.Net.Redis.Cache --version 0.5.0-beta.56                
NuGet\Install-Package CodeDesignPlus.Net.Redis.Cache -Version 0.5.0-beta.56                
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="CodeDesignPlus.Net.Redis.Cache" Version="0.5.0-beta.56" />                
For projects that support PackageReference, copy this XML node into the project file to reference the package.
paket add CodeDesignPlus.Net.Redis.Cache --version 0.5.0-beta.56                
#r "nuget: CodeDesignPlus.Net.Redis.Cache, 0.5.0-beta.56"                
#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 CodeDesignPlus.Net.Redis.Cache as a Cake Addin
#addin nuget:?package=CodeDesignPlus.Net.Redis.Cache&version=0.5.0-beta.56&prerelease

// Install CodeDesignPlus.Net.Redis.Cache as a Cake Tool
#tool nuget:?package=CodeDesignPlus.Net.Redis.Cache&version=0.5.0-beta.56&prerelease                

CodeDesignPlus.Net.Redis.Cache

Quality Gate Status Bugs Code Smells Coverage Duplicated Lines (%) Vulnerabilities

Description

The CodeDesignPlus.Net.Redis.Cache project provides a concrete implementation of the ICacheManager interface using Redis as the underlying caching mechanism. This library allows .NET applications to seamlessly leverage Redis for efficient caching, improving performance and scalability. It’s part of the CodeDesignPlus ecosystem, designed to work with the core caching abstractions provided in CodeDesignPlus.Net.Cache.

Table of Contents

About The Project

CodeDesignPlus.Net.Redis.Cache provides a reliable and high-performance way to use Redis as a caching provider. Built on top of CodeDesignPlus.Net.Cache, this library provides a direct way to integrate Redis caching into your application, taking full advantage of Redis' advanced features, while still keeping a clear separation of concerns.

Key Features

  • Redis Implementation: Provides a concrete implementation of the ICacheManager interface using Redis.
  • Serialization: Uses Newtonsoft.Json or similar for serializing and deserializing objects to store in Redis.
  • Asynchronous Operations: All methods are asynchronous, ensuring non-blocking I/O and improving application responsiveness.
  • Configuration: Supports configuration via connection strings.
  • Integration with CodeDesignPlus.Net.Cache: Seamlessly integrates with the abstract caching layer for easy switching between caching mechanisms.

Installation

To install the package, run the following command:

dotnet add package CodeDesignPlus.Net.Redis.Cache

Usage

Here's an example of how to use RedisCacheManager with the ICacheManager abstraction.

First, register the RedisCacheManager in the dependency injection container:

// In Startup.cs or your DI setup:
using CodeDesignPlus.Net.Redis.Cache.Extensions;
using Microsoft.Extensions.DependencyInjection;

public void ConfigureServices(IServiceCollection services)
{
    // ... other service registrations

    services.AddCache(Configuration);

    // ... other service registrations
}

Then, inject the ICacheManager into your services:

using CodeDesignPlus.Net.Cache;

public class MyService
{
    private readonly ICacheManager _cacheManager;

    public MyService(ICacheManager cacheManager)
    {
        _cacheManager = cacheManager;
    }

    public async Task<MyData> GetDataAsync(string key)
    {
        var cachedData = await _cacheManager.GetAsync<MyData>(key);
        if (cachedData != null)
        {
            return cachedData;
        }

        var data = await GetDataFromSourceAsync(key); // Some function to retrieve data

        await _cacheManager.SetAsync(key, data, TimeSpan.FromMinutes(10));

        return data;
    }

  // Assume this method return a task with the result
    private async Task<MyData> GetDataFromSourceAsync(string key)
    {
      // Your implementation here
       await Task.Delay(100);
       return new MyData() { Id=key, Name = "Example " + key};
    }
}

// A simple Model
public class MyData {
  public string Id { get; set;}
  public string Name { get; set; }
}

For more detailed information, please refer to our documentation at CodeDesignPlus Doc.

Roadmap

Refer to issues for a list of proposed features and known issues.

Contributing

  1. Fork the Project
  2. Create your Feature Branch (git checkout -b feature/AmazingFeature)
  3. Commit your Changes (git commit -m 'Add some AmazingFeature')
  4. Push to the Branch (git push origin feature/AmazingFeature)
  5. Open a Pull Request

License

Distributed under the MIT License. See LICENSE for more information.

Contact

CodeDesignPlus - @CodeDesignPlus - codedesignplus@outlook.com

Project Link: CodeDesignPlus.Net.Redis.Cache

Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.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
0.5.0-beta.60 30 1/7/2025
0.5.0-beta.59 34 1/7/2025
0.5.0-beta.57 29 1/7/2025
0.5.0-beta.56 40 1/6/2025
0.5.0-beta.54 37 1/6/2025
0.5.0-beta.39 65 1/3/2025
0.5.0-beta.38 65 1/3/2025