Caching.StackExchangeRedis.BetterRedis 1.0.1

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

// Install Caching.StackExchangeRedis.BetterRedis as a Cake Tool
#tool nuget:?package=Caching.StackExchangeRedis.BetterRedis&version=1.0.1                

BetterRedis .NET Library

Overview

BetterRedis is a .NET library designed to simplify the use of Redis caching and extend its capabilities. This library abstracts the complexities of working directly with Redis and offers a more streamlined interface for developers.

Features

  • Simplified API: Easy-to-use methods for common caching operations.
  • Data Serialization: Built-in support for efficient serialization and deserialization of objects.
  • Extensible: Easily extend and customize the library to fit your specific needs.

Installation

You can install the BetterRedis library via NuGet package manager:

dotnet add package BetterRedis

Alternatively, you can use the NuGet Package Manager in Visual Studio to search for and install BetterRedis.

Getting Started

Prerequisites

  • .NET 8.0 or later
  • Redis server (local or remote)

Basic Usage

  1. Configuration: Configure BetterRedis in your application startup:

    services.AddBetterRedis(options =>
    {
        options.ConnectionString = "your-redis-connection-string";
        // Additional configuration options
    });
    
  2. Caching Data: Use the BetterRedis cache manager to store and retrieve data:

    var cacheManager = serviceProvider.GetRequiredService<IRedisRepository>();
    
    // Set a value in cache
    await cacheManager.SetAsync("key", "value");
    
    // Get a value from cache
    var value = await cacheManager.GetAsync<string>("key");
    
  3. GetAsync Enhancement: Use the GetAsync method even if the data is not cached (it will query the database):

    await cacheManager.GetAsync("key", async () => "query-data-from-database");
    
  4. Cache Invalidation: Invalidate cache entries when necessary:

    await cacheManager.RemoveAsync("key");
    

    Or Invalidate all entries:

    await cacheManager.ClearAsync();
    
  5. Cache Extension: Extend the duration of cache entry:

    await cacheManager.RefreshAsync("key");
    

Contributing

We welcome contributions to enhance BetterRedis. To contribute:

  1. Fork the repository.
  2. Create a new branch for your feature or bugfix.
  3. Submit a pull request with detailed information about your changes.

License

This project is licensed under the MIT License. See the LICENSE file for details.

Contact

For any questions or support, please create an issue on GitHub or contact the maintainers.


BetterRedis makes Redis caching simple and efficient, enabling developers to build high-performance applications effortlessly. Try it out today and see the difference it can make in your .NET projects!

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
1.0.1 88 7/11/2024
1.0.0 73 7/11/2024