You can not select more than 25 topics
Topics must start with a letter or number, can include dashes ('-') and can be up to 35 characters long.
18 lines
457 B
18 lines
457 B
using FreeRedis;
|
|
|
|
namespace Cis.Core;
|
|
|
|
public static class CacheSetup
|
|
{
|
|
/// <summary>
|
|
/// Redis 缓存注册
|
|
/// </summary>
|
|
/// <param name="services"></param>
|
|
public static void AddCache(this IServiceCollection services)
|
|
{
|
|
var redisOptions = App.GetOptions<RedisOptions>();
|
|
RedisClient cache = new(redisOptions.ConnectionString);
|
|
cache.FlushDb();
|
|
services.AddSingleton<RedisClient>(cache);
|
|
}
|
|
}
|