54 lines
1.3 KiB
C#
54 lines
1.3 KiB
C#
using FreeRedis;
|
|
using FreeRedis.Internal;
|
|
using Microsoft.Extensions.DependencyInjection;
|
|
using NetTaste;
|
|
using Newtonsoft.Json.Schema;
|
|
using SqlSugar.IOC;
|
|
using System;
|
|
using System.Security.Cryptography;
|
|
using System.Text.Json;
|
|
using System.Threading.Channels;
|
|
using System.Threading.Tasks;
|
|
using System.Xml.Linq;
|
|
using UserCenter.Model.Enum;
|
|
|
|
namespace Learn.Archives.Core.Common
|
|
{
|
|
/// <summary>
|
|
/// redis key
|
|
/// </summary>
|
|
public static class RedisExpandKey
|
|
{
|
|
|
|
}
|
|
/// <summary>
|
|
/// redis拓展
|
|
/// </summary>
|
|
public static class RedisExpand
|
|
{
|
|
|
|
/// <summary>
|
|
/// redis 连接
|
|
/// </summary>
|
|
/// <summary>
|
|
/// 队列池
|
|
/// </summary>
|
|
static SubscribeListObject? Subscribe;
|
|
|
|
/// <summary>
|
|
/// 初始化 redis
|
|
/// <para>需要在初始化配置文件时候调用</para>
|
|
/// </summary>
|
|
public static void AddRedisExpand(this IServiceCollection service)
|
|
{
|
|
Console.WriteLine($"{DateTime.Now}=>初始化 Redis");
|
|
RedisClient Redis = new RedisClient(AppCommon.Config.Redis.ConnectionString);
|
|
Redis.Serialize = obj => JsonSerializer.Serialize(obj);
|
|
Redis.Deserialize = (json, type) => JsonSerializer.Deserialize(json, type);
|
|
service.AddSingleton(Redis);
|
|
|
|
}
|
|
|
|
}
|
|
}
|