AvvaMobile.Core.RedisClient
1.0.9
See the version list below for details.
dotnet add package AvvaMobile.Core.RedisClient --version 1.0.9
NuGet\Install-Package AvvaMobile.Core.RedisClient -Version 1.0.9
<PackageReference Include="AvvaMobile.Core.RedisClient" Version="1.0.9" />
paket add AvvaMobile.Core.RedisClient --version 1.0.9
#r "nuget: AvvaMobile.Core.RedisClient, 1.0.9"
// Install AvvaMobile.Core.RedisClient as a Cake Addin #addin nuget:?package=AvvaMobile.Core.RedisClient&version=1.0.9 // Install AvvaMobile.Core.RedisClient as a Cake Tool #tool nuget:?package=AvvaMobile.Core.RedisClient&version=1.0.9
AvvaMobile.Core.Redis.RedisClient
Join Our Open Source Team
If you love at least two of the followings, you are welcome to join our open source team, please contact us at opensource@avvamobile.com.
- Pizza 🍕 or Hamburger 🍔
- Beer 🍺 or Whiskey 🥃
- Video Games 🎮
- Car Racing 🏎️
- Electronic Music 🎛️ or Rock Music 🎸
Developers
NuGet Package
To use NuGet package, please go to https://www.nuget.org/packages/AvvaMobile.Core.RedisClient
Namespace
All necessary classes are in the namespace below.
using AvvaMobile.Core.Redis;
Dependency Injection
Client interface is IRedisClient
and implementation is RedisClient
.
Register the client in the program.cs
file.
builder.Services.AddSingleton<IRedisClient, RedisClient>(r => new RedisClient(host: "localhost", port: 6379, user: "default", password: "redispw"));
Then initiliaze the instance in the constructor of the class.
namespace AvvaMobile.Core.Redis.Samples;
public class Samples
{
private readonly IRedisClient _redis;
public Samples(IRedisClient redis)
{
_redis = redis;
}
}
Samples
Check Key Is Exists
var key = "foo";
var isExists = await _redis.IsExists(key);
if (isExists)
{
Console.Write("Key is exists.");
}
else
{
Console.Write("Key is NOT exists.");
}
Set Value
var key = "foo";
var valueString = "bar";
var resultString = await _redis.Set(key, valueString);
Get String
var key = "foo";
var stringValue = await _redis.Get_String(key);
Set Serialized
var key = "foo";
var value = new List<int> { 1, 2, 3, 4, 5, 6, 7, 8, 9, 0 };
var result = await _redis.Set_Serialized(key, value);
Get Deserialized
var key = "foo";
var valueList = await _redis.Get_Deserialized<List<int>>(key);
Set Select List Items (for Web)
var key = "foo";
var value = new List<SelectListItem>
{
new SelectListItem{Text = "Item 1", Value = "1"},
new SelectListItem{Text = "Item 2", Value = "2"},
new SelectListItem{Text = "Item 3", Value = "3"},
new SelectListItem{Text = "Item 4", Value = "4"}
};
var result = await _redis.Set_SelectListItems(key, value);
Get Select List Items (for Web)
var key = "foo";
var valueList = await _redis.Get_SelectListItems(key);
Remove a Key
var key = "foo";
await _redis.Remove(key);
Clear Database
await _redis.ClearAll();
Product | Versions 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. |
-
net8.0
- Microsoft.AspNetCore (>= 2.2.0)
- Microsoft.AspNetCore.Mvc (>= 2.2.0)
- StackExchange.Redis (>= 2.6.111)
NuGet packages (1)
Showing the top 1 NuGet packages that depend on AvvaMobile.Core.RedisClient:
Package | Downloads |
---|---|
AvvaMobile.Core
This package is build for Avva Mobile developers to make their solutions easy to develop. |
GitHub repositories
This package is not used by any popular GitHub repositories.