修改包
This commit is contained in:
parent
c52f557ace
commit
5d8d005c38
1
server/C#/HoneyBox/.gitignore
vendored
1
server/C#/HoneyBox/.gitignore
vendored
|
|
@ -82,3 +82,4 @@ logs/
|
|||
secrets.json
|
||||
*.pfx
|
||||
*.p12
|
||||
.vs/*
|
||||
|
|
@ -16,7 +16,7 @@
|
|||
<PackageReference Include="Serilog.AspNetCore" Version="8.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.Console" Version="5.0.0" />
|
||||
<PackageReference Include="Serilog.Sinks.File" Version="5.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.2.1" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
|
|
@ -7,7 +7,8 @@
|
|||
<ItemGroup>
|
||||
<PackageReference Include="Mapster" Version="7.4.0" />
|
||||
<PackageReference Include="Mapster.DependencyInjection" Version="1.0.1" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Logging.Abstractions" Version="10.0.1" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
</ItemGroup>
|
||||
|
||||
<PropertyGroup>
|
||||
|
|
|
|||
|
|
@ -1,4 +1,4 @@
|
|||
using System.Text.Json;
|
||||
using System.Text.Json;
|
||||
using Microsoft.Extensions.Configuration;
|
||||
using StackExchange.Redis;
|
||||
|
||||
|
|
@ -52,7 +52,7 @@ public class RedisCacheService : ICacheService, IDisposable
|
|||
return;
|
||||
|
||||
var json = JsonSerializer.Serialize(value);
|
||||
await _database.StringSetAsync(key, json, expiry);
|
||||
await _database.StringSetAsync(key, json, expiry,When.Always);
|
||||
}
|
||||
|
||||
public async Task RemoveAsync(string key)
|
||||
|
|
|
|||
|
|
@ -1,5 +1,7 @@
|
|||
using HoneyBox.Core.Interfaces;
|
||||
using HoneyBox.Core.Interfaces;
|
||||
|
||||
using Microsoft.Extensions.Configuration;
|
||||
|
||||
using StackExchange.Redis;
|
||||
|
||||
namespace HoneyBox.Infrastructure.Cache;
|
||||
|
|
@ -16,13 +18,13 @@ public class RedisService : IRedisService, IDisposable
|
|||
public RedisService(IConfiguration configuration)
|
||||
{
|
||||
var connectionString = configuration.GetConnectionString("Redis") ?? "localhost:6379";
|
||||
|
||||
|
||||
try
|
||||
{
|
||||
var options = ConfigurationOptions.Parse(connectionString);
|
||||
options.AbortOnConnectFail = false;
|
||||
options.ConnectTimeout = 5000;
|
||||
|
||||
|
||||
_connection = ConnectionMultiplexer.Connect(options);
|
||||
_database = _connection.GetDatabase();
|
||||
_isConnected = _connection.IsConnected;
|
||||
|
|
@ -47,7 +49,7 @@ public class RedisService : IRedisService, IDisposable
|
|||
if (_database == null || !_isConnected)
|
||||
return;
|
||||
|
||||
await _database.StringSetAsync(key, value, expiry);
|
||||
await _database.StringSetAsync(key, value, expiry, When.Always);
|
||||
}
|
||||
|
||||
public async Task DeleteAsync(string key)
|
||||
|
|
|
|||
|
|
@ -14,7 +14,8 @@
|
|||
<PackageReference Include="Autofac" Version="8.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Configuration.Abstractions" Version="9.0.0" />
|
||||
<PackageReference Include="Microsoft.Extensions.Http" Version="9.0.0" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.7.0" />
|
||||
<PackageReference Include="Newtonsoft.Json" Version="13.0.4" />
|
||||
<PackageReference Include="StackExchange.Redis" Version="2.10.1" />
|
||||
</ItemGroup>
|
||||
|
||||
</Project>
|
||||
|
|
|
|||
|
|
@ -1,7 +1,7 @@
|
|||
<Project Sdk="Microsoft.NET.Sdk">
|
||||
|
||||
<PropertyGroup>
|
||||
<TargetFramework>net8.0</TargetFramework>
|
||||
<TargetFramework>net10.0</TargetFramework>
|
||||
<ImplicitUsings>enable</ImplicitUsings>
|
||||
<Nullable>enable</Nullable>
|
||||
<GenerateDocumentationFile>true</GenerateDocumentationFile>
|
||||
|
|
@ -16,6 +16,7 @@
|
|||
<PrivateAssets>all</PrivateAssets>
|
||||
</PackageReference>
|
||||
<PackageReference Include="Microsoft.EntityFrameworkCore.SqlServer" Version="8.0.0" />
|
||||
<PackageReference Include="System.IdentityModel.Tokens.Jwt" Version="8.15.0" />
|
||||
</ItemGroup>
|
||||
|
||||
<ItemGroup>
|
||||
|
|
|
|||
Loading…
Reference in New Issue
Block a user