RedisHelper 1.0.0

Suggested Alternatives

EasyCache.Cache

Additional Details

This package has been deprecated and included in EasyCache.Cache

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

// Install RedisHelper as a Cake Tool
#tool nuget:?package=RedisHelper&version=1.0.0                

RedisHelper - .Net Core

Nuget

Introduction

Redis Helper is a simple way to handle caching items in Redis. It utilizes IDistributedCache to help handle caching of items.

Documentation

Installation / Setup

You can install RedisHelper through Nuget package manager by running the following:

Install-Package RedisHelper -Version 1.0.0

If you use the dotnet CLI you can use the following:

dotnet add package RedisHelper
appsettings.json

In your appsettings.json you'll need to include the following entry to connect to your redis installation

"Redis": {
    "Host": "127.0.0.1:6379",
    "Instance":  "RedisInstanceName" 
}
Startup.cs

Add services.SetRedisHelperServices(); to your ConfigureServices method:

public void ConfigureServices(IServiceCollection services)
{
    // Other Code

    services.SetRedisHelperServices();

    // Other Code
}
Usage
Dependency Injection

You can utilize depency injection to bring the RedisHelper into your controller. An example when using RedisHelper in your HomeController can be seen here:

private readonly RedisHelper.Cache.RedisHelper _redisHelper;

public HomeController(RedisHelper.Cache.RedisHelper redisHelper)
{
    _redisHelper = redisHelper;
}
Storing Items In The Cache

You may use the Put method to store items in the cache. The Put method requires you to set an expiration in seconds.

When using RedisHelper in the DI container you can use the following:

var seconds = 10;
_redisHelper.Put("key", "value", seconds);

To store an item that does not expire you can use the Forever method. This will store an item in cache until it is removed manually

_redisHelper.Forever("key", "value");
Retrieving Items From The Cache

The Get method is used to retrieve items from the cache. If the item does not exist in the cache, null will be returned.

_redisHelper.Get("key");
Removing Items From The Cache

You may remove items from the cache using the forget method:

_redisHelper.Forget("key")
Checking For Item Existence

The Exists method can be used to determine if an item exists in the cache. If the value is null this method will return false

_redisHelper.Exists("key");

License

RedisHelper is open-sourced software licensed under the MIT License

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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. 
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 1,249 4/1/2020 1.0.0 is deprecated because it is no longer maintained.